Show Post from parent category (custom taxonomy) ONLY!

Any tax_query can take an include_children argument (see Codex) that defaults to true. So just add that to your code and it should work: <?php $args = array( ‘posts_per_page’ => 100, ‘post_status’ => ‘publish’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘ait-dir-item-category’, ‘field’ => ‘id’, ‘terms’ => 75, ‘include_children’ => false ) ), ‘post_type’ => ‘ait-dir-item’ … Read more

Loop with Dynamic Categories

The code below enables categories for pages. An example page template is provided which loops through the categories assigned to the page and displays the posts for each category. If you want to limit the user to selecting only one category, you can use a solution such as Taxonomy Single Term. Associate the category taxonomy … Read more

How to display Last Updated date from the latest post for a category list

<?php // select all sub categories of parent cat with id ‘8’ $categories = get_terms( ‘category’, array( ‘orderby’ => ‘ID’, ‘parent’ => 8 ) ); // For each sub category find last post foreach ( $categories as $category ) { $args = array( ‘cat’ => $category->term_id, ‘post_type’ => ‘post’, ‘posts_per_page’ => ‘1’, ‘orderby’ => ‘date’, … Read more

Categories – create a new separate set right after the default?

When you create custom taxonomy use post as object type for the taxonomy: register_taxonomy(‘your_custom_taxonomy’, ‘post’, $args); New custom taxonomy will appear at the end of “Posts” submenu, below “Tags”. To change this order add this code (to functions.php or plugin file): add_filter(‘menu_order’, ‘reorder_post_submenu’, 15); function reorder_post_submenu($menu_order) { global $submenu; if (isset($submenu, $submenu[‘edit.php’])) { $i_offset = … Read more

Is there a way to remove categories in bulk?

Yes and no. The main ‘uncategorized’ category is the main one built into the core, and shouldn’t be removed. You can rename it to something else. If they are still attached to the posts, then you could delete it from the database tables directly.