How can i sort the categories by ID

wp_list_categories takes an orderby parameter which accepts : ID – Default name slug count term_group So the default behavior of wp-list-categories is to order by ID but you can specify that like so: <?php wp_list_categories(array(‘exclude’=> 73,’orderby’ => ‘ID’));?>

How to filter posts that belong to a specific category only if that is the only category

You will need more than one query because before querying posts you have to know what posts to exclude. I personally don’t see anything bad in ‘cutoff’. This code should work properly: Update: It breaks pagination (see comments). <?php $category_to_filter = 11; while ( have_posts() ) : the_post(); $categories = get_the_category(); if( in_array($category_to_filter, $categories) && … Read more

Animated gif for a thumbs

To use gifs in WordPress you need to insert the full size of the uploaded gif (the original size). In the Media Box : Size: Full Size Any other size you choose will not render because of how GD crops and re-sizes the photos, it does so by taking a single frame, to make it … Read more

How to find what index page a post is on?

There’s no way to do it directly but there’s a way to determine the position of a particular row in a mysql query. You can find out how to do it here- https://stackoverflow.com/questions/3614666/mysql-get-row-position-in-order-by Once you have the position you can divide it with the value from get_option(‘posts_per_page’) to determine the correct page number.

How to Separate CPT From Regular Posts?

The issue was that the get_previous/next nav filters were “out in the open” in the plugin; so they were executed every time the plugin was loaded. I put them in a function called myplugin_set_nav_filters(), which I invoked before the loop in the CPT single template, and everything worked as advertised. Now the nav on regular … Read more