Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

liamaust on "How to hide content that should be hidden (membership area)"

0
0

I'm using Paid Memberships Pro plugin on my site and its showing content that should be hidden.

It looks like the issue is that PMP is running their check to see if a post is restricted to members before page builder’s content is rendered. That means that once page builder’s content is rendered, it’s overriding PMP’s login/register form.

The reason this is happening is because PMP’s check is happening at an earlier priority of 5 whereas the default is 10…

add_filter('the_content', 'pmpro_membership_content_filter', 5);

I changed the priority to 15 as described here:

https://www.wpbeaverbuilder.com/support/q/paid-memberships-pro/

but it still doesnt work!

Here is the code I tried:

/*
	Tell PMPro to filter the_content a bit later.

	This will sometimes fix issues where theme or plugin elements (e.g. videos)
	are not being filtered by PMPro. Note that this sometimes will cause
	some things (e.g. share links) to be filtered that you don't want to be
	filtered... and sometimes edits to the theme or a child theme are
	required to get the desired effect.

	Add this to your active theme's fucntions.php or a custom plugin.
*/
function my_init_change_pmpro_content_filter_priority()
{
	remove_filter('the_content', 'pmpro_membership_content_filter', 5);
	add_filter('the_content', 'pmpro_membership_content_filter', 15);
}
add_action('init', 'my_init_change_pmpro_content_filter_priority');

starapple on "Accessing and Manipulating Custom User meta Data"

0
0

I'd greatly appreciate help in learning about the appropriate way to store some custom user meta data. Users are required to enter their information in four columns in the following pipe separated format:

Wt|Rt|Group|Title
1|10|2|Name
2|15|2|Name 1
3|20|2|Name 2
4|25|2|Name
5|30|2|Name 1
1|11|3|Name
2|16|3|Name 1
3|21|3|Name 2
4|26|3|Name
5|31|3|Name 1

I need to be able to retrieve specific lines of information to do calculations. For example, if someone chooses Group 3 with a specific Group and Wt, I should be able to fetch the relevant Rt.

When I examine stored meta data in WP, some of it seems unreadable and I understand that's because it's serialized. However my data is stored literally as it is entered line by line by the user. Is there any benefit in serialization vs literal insertion of the meta data? (When I use the serialize() function it just chunks the entire batch of data.)

Could you please give an example of retrieving data in my example for someone choosing Group 3 with a Wt of 2 and fetching the Rt for use in a calculation?

I'm looking for the steps after get_user_meta( $user->ID, 'my_custom_groups');

Thanks.

ramochoa on "Finding hooks?"

0
0

I know there are lists of hooks for WordPress like --> http://adambrown.info/p/wp_hooks/hook

But if I want to find hooks for a plugin like WC Vendors there is a much shorter list of hooks like --> https://www.wcvendors.com/kb/list-filtersactionshooks/

Are 'do_action' and 'apply filter' functions the only thing we can modify?
If given a class like --> https://github.com/wcvendors/wcvendors/blob/master/classes/admin/class-product-meta.php#L10, is there any way to modify it?

Are we limited to the do_action hooks or is there a way to modify other areas as well? Can we use the WordPress hooks to hook into the WC Vendors plugin as well?

Liv on "Change title tag with custom fields for pages, posts and woocommerce products."

0
0

Hi,

I'd like to be able to change the title tag individually for pages, posts, category pages and products (woocommerce) by using a custom field.

Is there anyone that knows how to accomplish this without a SEO plugin?

Cheers!

Liv

graham333 on "Problem: Wp content editor container moving up/down with page scrolling"

0
0

Hi folks,
Hope this is in the right place, as I wondered if it should go in the Advanced section of the forum.

Expert Wp ninja required for this problem I think :-)

Dunno what's happened but I would like to try and fix this if possible.

Whenever I edit a page or post in the Wp Admin, the whole container for the wp content editor toolbar including the mce container and all the buttons move up and down thus obscuring the content as I scroll up and down.

It does this in both Wysi and Text edit modes, and happens right away if I paste in a block of text.

It usually starts off okay, after some editing it become detached from the top.

I have tried switching off Wysi but it still does it.

The theme is 2012 default with child.

I can get a short temporary fix by switching over to the 2012 Parent theme, and then switching back again but it doesn't last for long.

Any ideas on how to fix this most annoying problem guys?, because it's interfering with my workflow.

John McCarthy on "Woocommerce - Split check out process to two pages"

0
0

Hi,

I know that Woothemes have a multi page checkout process in their road map. I'm currently attempting to add this type of functionality to a site I'm working on.

I've created two custom form fields which have been working fine for the past two years. What I'm attempting to do is to instead have these forms on a separate page before the main checkout.

So far I've:

- Created a custom template "checkout stage 1"
- Created a page, applied the template and set this page as the checkout page in WooCommerce settings
- Added my custom form fields to my template within
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="http://localhost/mysite.dev/checkout" enctype="multipart/form-data">
- Proceeded by
<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="submit" data-value="submit">

I know I'm missing elements here, which I'm in the process of tracking down and testing, but if anyone has any advice or could tell me if this is even possible I'd really appreciate it.

Thanks

toneburst on "Widget Excluding Posts Homepage. Possible?"

0
0

I'm writing a sidebar widget plugin that scans posts in a selected category for embedded YouTube videos, and displays the first one found using oEmbed.

Works great, but I'd like to ensure that the displayed post does not also appear on the Homepage.

To do that, I tried adding

// Hide category from Homepage if option set
add_filter( 'pre_get_posts', function( $query ) {
   if( $instance[ 'excludeCategory' ] == 'on' ) {
	   if( $query->is_home )
		   $query->set( 'category__not_in', array( $instance[ 'category' ] ) );
   }
   return $query;
} );

to the constructor function of my plugin.

This doesn't work, and I suspect I know why. The main query that retrieves the posts in the primary loop must run before the widget is able to modify it.

Am I right on this, and if so, is there any way to get this to work, or will I have to build a separate non-widget plugin to be able to achieve what I want?

Cheers,

a|x

ramochoa on "Turn a class into a hook?"

0
0

If given a class that has no hook, how would one turn it into a hook?

I know you need to wrap it in a function. But what would the function look like? Where would we save the file?


powerfix on "Paid Memberships Pro - Renew Issue"

0
0

Hi there,

I'm using a fairly generic setup with PMPro, but I've just discovered something that is causing me some grief.

My users signup by selecting a particular "holding" level to be vetted manually. Once they have been approved, the membership level is changed to a "full" membership. I use this tier system to hide certain pages until they are approved.

The problem exists when the users "full" membership expires - the user cannot renew the account. I've found the culprit in the code as below:

/paid-memberships-pro/preheaders/checkout.php [Line 68]

It appears that the only way for the member to renew is if the level has "allowSignups" selected. Which means the code fails in my situation.

3 questions:

1. Have I correctly configured the levels as per my situation or is there a better way?
2. Is this a bug? I would assume that a member can renew their membership and in this use case they cannot. The code doesn't even gracefully fail with an error message - it simply redirects back to the levels page.
3. What is the best way to patch this code and prevent overwrites?

Thanks in advance.

rinse04 on "Does this exist??"

0
0

Hi, I'm wondering if anyone can possibly help?
I'm after a plugin where the front end will exist of an input field, where the user will input a reference number, then press enter to show some data that relates to that reference number. This would lookup data that I have input into a table within the admin section or directly into SQL.
Does anything like this exist?
Many thanks in advance.

[Moderator Note: No bumping. If it's that urgent after just 5 hours, please consider hiring someone instead.]

nikola797992 on "Autoplay video on page load"

Guido on "Add custom post type categories"

0
0

Hi,

I have a plugin that uses a custom post type called 'event'.
I want to add custom event categories so users can list events by categorie.

So I should use register_taxonomy for this.

This default code creates a custom TAG page:

function my_plugin_taxonomy() {
	register_taxonomy( 'my_custom_taxonomy', 'event'  );
}
add_action( 'init', 'my_plugin_taxonomy' );

How can I create a custom category page in stead?

Note: I know how to create a default category page (via register_post_type) but I don't want to use the default (post) categories.

Guido

haleylusk on "Code Snippet Plugin crashed site, deleted, saved PHP codes crashed again"

0
0

Hi there! I would love to use this plugin as I am not super great at php coding. I deleted through hostagator file directory but when i tried to download again it kept my bad coding. I know it would be wise to input the fail safe into my wp-admin.php but im not sure how to do so? is there a way to use the plugin again without the saved files?

Arevico on "WP List Table Footer"

0
0

Hi,

I'm developing a new plugin which uses many (small tables). By default rendering a WP_List_Table class duplicates the header as footer. On large tables this may be desireable, but I really do want to exclude this footer. If there any way to do this?

Best regards,
Arevico

hnnaps on "Website down including admin"

0
0

Hi...I just did an update to my website http://www.holyname.net. Now the entire site is down and I can't even get into my admin portal. This is for a school, please help


keytastic on "searchable media tags"

0
0

I'm trying to make it so that authors can tag their media and search for media using those tags. Currently I am running into two problems with my code:

  1. The Media Tags page doesn't show up in the Dashboard for anyone but the administrator
  2. Tagged pictures don't show up in search!

Here is my code:

<?php

/**
// register new taxonomy which applies to attachments
function wptp_add_media_tag_taxonomy() {
    $labels = array(
        'name'              => 'Media Tags',
        'singular_name'     => 'Media Tag',
        'search_items'      => 'Search Media Tags',
        'all_items'         => 'All Media Tags',
        'parent_item'       => 'Parent Media Tag',
        'parent_item_colon' => 'Parent Media Tag:',
        'edit_item'         => 'Edit Media Tag',
        'update_item'       => 'Update Media Tag',
        'add_new_item'      => 'Add New Media Tag',
        'new_item_name'     => 'New Media Tag Name',
        'menu_name'         => 'Media Tag',
    );

    $args = array(
        'labels' => $labels,
        'hierarchical' => true,
        'query_var' => 'true',
        'rewrite' => 'true',
        'show_admin_column' => 'true',
    );

    register_taxonomy( 'media_tag', 'attachment', $args );
}
add_action( 'init', 'wptp_add_media_tag_taxonomy' );

Is there a better way to do this? It seems odd to me that there isn't a good way to tag and search photos.

BobNwp on "Question about get_categories function"

0
0

I am trying to get a list of category names and links, to put in a select for a side bar.

To create a dropdown list for categories, I tried:

$catlinks = get_categories(array('type' => 'link'));

got this message:

Notice: get_categories was called with an argument that is deprecated since version 3.0! in /hermes/bosoraweb081/b1107/myd.sugarcatsimon/public_html/pdmeoff/pdroot/welg/wp-includes/functions.php on line 3570

I looked at the documentation for the function again and saw that I had missed this text:

Note: type=link has been deprecated from WordPress 3.0 onwards. Use taxonomy=link_category instead.

I am unsure exactly what that means as regards coding the get_categories function call.

I tried:

$catlinks = get_categories(array('taxonomy=link_category'));

The argument was ignored - the output was the same as a call with no arguments - a list of categories. I want links.

I changed double quotes to single quotes:

$catlinks = get_categories(array("taxonomy=link_category"));

Next I tried the same thing without any quotes at all:

$catlinks = get_categories(array(taxonomy=link_category));

Got the message:

Parse error: syntax error, unexpected '=', expecting ')' in /hermes/bosoraweb081/b1107/myd.sugarcatsimon/public_html/pdmeoff/pdroot/welg/wp-content/themes/thingspissed/sidebar.php on line 75

What am I missing here? How do I use taxonomy=link_category instead of 'type' = 'link' to get a dropdown list for recent comments?

Anderspin on "Why won't my meta box show in admin?"

0
0

Hi!

I'm trying to display a meta box in my custom post admin space. It won't work.

Can anyone help med with this? Probably just some silly mistake.

add_action( 'add_meta_box' , 'wd_pris_storlek' );

function wd_pris_storlek(){
	add_meta_box( 'prisstorlek', 'Pris och storlek', 'wd_skapa_metabox', 'tavlor', 'normal', 'high' );
	}

	function wd_skapa_metabox( $post ){
		//Hämta metadata om den redan finns
		$wd_pris = get_post_meta( $post->ID, '_wd_pris', true );
		$wd_storlek = get_post_meta ( $post->ID, '_wd_storlek', true );

		echo "Var snäll att fylla i upgifterna om pris och storlek för tavlan: ";
		?>
		<p>Pris: <input type ="text" name="wd_pris" value=" <?php echo esc_attr ( $wd_pris ); ?> " /> </p>
		<p>Storlek: <input type ="text" name="wd_storlek" value=" <?php echo esc_attr ( $wd_storlek ); ?> " /> </p>

		<?php
		}

	//Hook att spara uppgifterna vid
	add_action( 'save_post', 'wd_spara_meta');

	function wd_spara_meta($post_id){
		//Verifiera att postdata är ifyllt
		if (isset ($_POST['$wd_pris'] )) {
			//Spara metadata
			update_post_meta( $post_id, '_wd_pris', strip_tags($_POST['wd_pris']));
			update_post_meta( $post_id, 'wd_storlek', strip_tags($_POST['wd_storlek']));
	}
}
?>

Thank you!
Anders

ctma on "Error: warning creating default object from empty value in"

0
0

I have this error in wp-admin/includes/theme.php.

Help me , please....

PHP Warning: Creating default object from empty value in C:\Domains\mylittlegenius\mylittlegenius.com.my\wwwroot\wp-admin\includes\theme.php on line 24

Thanks.

Navia Ang on "Modify Header Image become 3 images"

0
0

I'm using Twenty Thirteen Theme, I like to change my header image become 3 images, maybe using bootstrap's Fluid Grid System 2-8-2 with responsive, like

|-- image1--| -------- image2-------- | --image3--|
<------2----><-----------8------------><----2----->

And how to make it max-width : 1080px and height : 80px.

Thanks for advices.

Viewing all 8245 articles
Browse latest View live




Latest Images