Tag Info

New answers tagged

1

You are almost close. add_filter( 'some_custom_filter', array( $this, 'filter_suppress_the_content' ), 10, 3 ); // the above line states that, the method `filter_suppress_the_content` should have three arguments, where you have used nothing. public function filter_suppress_the_content() { return true; } // comparing your code, this method should have ...


0

i think the best way to alter images is through css. you add a class to all your pictures that would set its size into your custom size. I think bootstrap has that feature


4

You can use the category__in argument: // use get_the_category( $post_id ) if you are outside the loop $categories = get_the_category(); if( $categories ){ $related_posts = get_posts( array( 'category__in' => $categories ) ); }


-1

I use this: add_action('pre_get_posts','search_filterr');function search_filterr($query) { if ( !is_admin() && $query->is_main_query() ) { if ( $query->is_search ) { $arrs[]='post'; $query->set('post_type', $arrs ); query->set('category__in', $CAT_ID); } ...


0

I figured it out. It looks as if the Codex never referenced the one parameter I needed to make it work in the Codex. I checked out this site here for a full list of parameters in the arrays http://www.billerickson.net/code/wp_query-arguments/ I needed to use post_parent and not child_of or parent. Fixed.


0

Just use the $product parameter to get the custom field value, and determine what to return: function custom_price_html( $price, $product ) { if ( ( int ) get_post_meta( $product->id, 'price_per_person', true ) ) $price .= ' per person'; elseif ( ( int ) get_post_meta( $product->id, 'price_per_group', true ) ) $price .= ' per ...


0

The recommended best practice is to use a mu-plugin for this. Adding add_filter()s to wp-config.php directly can cause all kinds of other problems and conflicts.


0

The author key/value query won't work. Try modifying the query by moving the query out of the meta query like so: array( 'author' => $author, 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'leads_status', 'value' => '-1', ), array( 'key' => ...


0

It's actually used by WP to allow plugin developers change WP behavior. You can make your code flexible using do_action so other plugin/theme developers or simply yourself can change behavior of your code. For example imagine you have a WP loop in a theme framework. You would like to add breadcrumb at the top of it, here is the simplest method: ... ...


0

Your plugin code is going to run before the theme code and hence will run before anything is added to the hook. You will need to the code that processes the file inclusion to some other hook that runs after all of the plugins load, like after_setup_theme This should help: Is there a flowchart for wordpress loading sequence?


2

The thing with class methods is that unless they're static, they belong to an object. And in your case your object is: new WC_Admin_Taxonomies_new(); Which means PHP will create the object and keep it in memory. But unfortunately, since you're not assigning this object to a variable, you have no way of referencing it later in your code. Off the top of my ...


1

If I understand you correctly you're not looking for the wp_search_stopwords filter type of solution. So here's a modification of the great answer by @kaiser that you referred to: /** * Exclude array of words from all search queries in the front-end * * Modification of http://wordpress.stackexchange.com/a/41100/26350 by @kaiser */ add_filter( ...


0

I think these should be separate taxonomies. Category is actually a taxonomy in its own right. You would create a taxonomy for each of the filters/drop-downs. This may seem like overkill but i think it will make it easier to work on additional features down the road. Add the following method to your functions.php. Replace 'rwc' with your theme's domain: ...


0

Another way that @toscho's solution made me try, and worked for me, is this scheme: http://example.com/videos/?tag=crazy


0

If you have done the first part correctly in loop-home.php, you can just simply move that into the appropriate template used by your archive pages. Taken into account that you have not used custom queries to build your queries on the homepage or any of the archive pages, you can do the following which will work on any of the aforementioned pages Use the ...


1

Im no expert on this but here goes: After reading some code and doing a global search of the filter, its not a filter at all, the only time that filter is called is in a do_action // HOOKABLE: This action runs just before logging the user in (before creating a WP cookie) do_action( "wsl_hook_process_login_before_wp_set_auth_cookie", $user_id, ...


0

a little late, but it might be because this is a filter, and you're adding it as an action, try add_filter( 'wp_embed_handler_youtube', 'bigger_youtube_embeds', 10, 4); function bigger_youtube_embeds($embed, $attr, $url, $rawattr) { // alter the $embed string... return $embed; }


0

Is it default text widget? If yes, then I don't think there is a way. Why don't you create a custom text widget? And before echoing output process the text whatever you wants to do? The logic is, you will create another widget, that will take some text (or html?) and you will process that text, add some data what you want and show as output :)


0

You need to unset() the body_class() as you would do with a normal array. You can do the following: (CAVEAT: Untested) add_filter( 'body_class', function ( $classes ) { foreach ( $classes as $key => $value ) { if ( $value == 'NAME_OF_BODY_CLASS' && is_category( 8 ) ) unset( $classes[$key] ); } return $classes; ...



Top 50 recent answers are included