Allow users to exclude categories? (WP 3.1.2)
Use the plugin Taxonomy Drill-Down from @scribu.
Use the plugin Taxonomy Drill-Down from @scribu.
I can only assume that on the page there are either multiple queries or instances of this post, but eitherway it exposes a flaw in the logic, that you’re not checking if the style has already been added. Normally one would use wp_enqueue_script which would sort this out, but for whatever reason you may not … Read more
Here’s what I came up with to accomplish this. I’m not naive enough to think this is the best way, but it works. Again, still interested to know if others have any better ideas. Ultimately, the reason why I needed to do this was because I use the domain mapping plugin, and I have it … Read more
You can take advantage of the template_redirect hook and redirect any request to the WordPress feed to a URL that you define. The most important thing to consider is the case when users are attempting to access the feed itself. In that case, you’d obviously not want to do any redirection. Here’s how you can … Read more
You can’t check the context while the filter callback is called, because the element is already in the frontend. There are 3 solutions though: 1. jQuery Search for the element and add html to the places in the name. 2. PHP in element Get the bloginfo(‘name’); in the element and change it on that place … Read more
I am answering a question after like 6 months, so I expect the quality of my answer not upto WPSE standards and hence would love feedback from other experience WPSE gurus. Add the following function to your functions.php function filter_category_list_by_slug( $slug, $categories ) { $excluded_parent = get_category_by_slug( $slug ); $excluded_cats = get_categories( array( ‘child_of’ => … Read more
Single filter call Just give this plugin a try. It illustrates the whole technique. <?php /** Plugin Name: (#69351) Example single filter call on <code>’the_content'</code> */ function wpse69351_single_call( $content ) { // Only for single view request (post, page, etc.) if ( ! is_singular() ) return $content; // This removes the filter during its first … Read more
CSS is the answer. If you look at the HTML code of each row (<tr>), you will see that it has classes that include post ID, post status, post tags, categories, and so on. So, you can easily apply CSS rules based on that classes and based on post tags. For example, this is a … Read more
To ignore dots (.) in the search parameter s, for all backend searches, we can use: /** * Ignore dots in all backend searches */ add_action( ‘pre_get_posts’, function( \WP_Query $q ) { if ( is_admin() && $q->is_search() ) $q->set( ‘s’, str_replace( ‘.’, ”, $q->get( ‘s’ ) ) ); } ); We can further restrict it … Read more
Filters are for modifying data that’s passed through them. You need to take the input, modify it, then return it. function exclude_not_allowed_terms( $args, $taxonomies ) { if(!current_user_can(‘edit_others_posts’) && in_array( ‘my-taxonomy’, $taxonomies ) ) { $args[‘meta_query’] = array( array( ‘key’ => ‘owner’, ‘value’ => get_current_user_id() ) ); } return $args; } add_filter( ‘get_terms_defaults’,’exclude_not_allowed_terms’, 20, 2 );