New answers tagged

0

From the WP-Admin. Click on Appearance > Menus In the top right, click "Screen Options" Select (check) "CSS Classes" Then you will have added the optional "CSS CLASSES" to each menu item.


1

Here's an approach similar to what @Milo suggests. Let's say we have: $tags = wp_get_post_tags( 123 ); If we need to filter out the term with term_id 15, we can use wp_list_filter: $_tags = wp_list_filter( $tags, [ 'term_id' => 15 ], 'NOT' ); where the NOT is the operator for excluding it. If we also need to pluck out a single attribute we can ...


1

METHOD 1 - wp_get_post_terms() We can make use of the wpse_exclude parameter to exclude and array of terms from the list of post terms. wp_get_post_tags() internally uses wp_get_post_terms() which uses wp_get_object_terms(). When looking at the source of the latter, we see that we can make use of the wp_get_object_terms filter to filter the output from the ...


3

If we look at the WP_REST_Controller::get_collection_params() method, we can see the minimum is 1 and the maximum is 100: 'per_page' => array( 'description' => __( 'Maximum number of items to be returned in result set.' ), 'type' => 'integer', 'default' => 10, 'minimum' => 1, '...


0

Try this i did this for my product tags, so you just need to change the reference to product_tag & product to post_tag and post. You are basically making the taxonomy of post_tag hierarchical. I cant recall where i got this from but once I remember I will post link to it You will need to add it to your functions.php //Make Product Tag Hierarchical ...


0

This isn't the most helpful answer, but here is the plugin I have used which attempts to do that: Related Topics Simple Tag List.


6

Here's a script that you can enqueue into your admin panel. It will add a new tab to the category tabs called "Active". Whenever a checkbox is checked, it gets added to the "Active" tab list, you can also click links in the "Active" tab list to remove them ( uncheck them ). Add this as an external script, custom-tabs.js maybe: jQuery( document ).ready( ...


0

The easiest way would be to add a meta box and use get_the_category_list to show the categories that already have been selected. This only works if you save your post, just like the tags are only shown in their own box after you confirmed them. If you want to do this on the fly, you will need javascript to fill your metabox. Put a selector on all checkboxes ...


3

We can use the content_paginationcodex filter to modify the paginated content without modifying the globals directly: add_filter( 'content_pagination', function( $pages ) { // Target only the correct utm_campaign GET parameter if( 'nonextpagecampaign' !== filter_input( INPUT_GET, 'utm_campaign', FILTER_SANITIZE_STRING ) ) return $pages; ...


4

You can use the_post hook to remove <!--nextpage-->. In this case: add_action( 'the_post', 'campaign_remove_nextpage', 99); function campaign_remove_nextpage ( $post ) { if ( ($_GET['utm_campaign']== 'nonextpagecampaign') && (false !== strpos( $post->post_content, '<!--nextpage-->' )) ) { // Reset the global $pages: ...


-1

If you have a lot of tags this is going to be pretty inefficient, but still, it should get the job done... This first part is a little pointless but it will pare down to posts in the category that actually have tags. add_action('pre_get_posts', 'get_category_tag_posts'); function get_category_tag_posts($q) { if ( !is_admin() && $q->...


3

There really is no sane way to accomplish this, specially if you have posts that are assigned to more than one tag (which is almost always the case). What is very sure, you have you work cut out for you. Here are some thought and ideas you can persue: POSTS WITH MULTIPLE TERMS If posts have more than one tag (or any term for that matter) assigned to them, ...


1

What am i missing? 'tag' may be a valid argument for get_posts() via WP_Query, but requires the tag slug in that case. Try using 'tag_id' instead. get_posts() apparently enables 'category', but expects the the ID, even though in WP_Query the same argument is 'cat' (vs. 'category_name', et al). A little confusing, perhaps, altogether. I know it still ...



Top 50 recent answers are included