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.

Category page showing posts from all categories

That happens because you are overwriting the query with you $args, If you want to modify it and not overwrite it then use this format: //get the $query_string in to your $args array global $query_string; parse_str( $query_string, $args ); //modify whatever you want $args[‘post_type’] = ‘post’; $args[‘posts_per_page’] = 5; $args[‘orderby’] = ‘comment_count’; query_posts($args);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)