Nicer URL for viewing category of posts?

If you want to remove the /category/ base from wordpress urls then I recommend that you use WP No Catgeory base plugin Quote from plugin discription – This plugin will completely remove the mandatory ‘Category Base’ from your category permalinks e.g. myblog.com/category/my-category/ to myblog.com/my-category/

query_posts not reading correct categories

Firstly, avoid query_posts, instead use WP_Query or hook into pre_get_posts. query_posts is bad practice, a performance hit/slowdown, and a source of many troubles. As a fulltime developer I wouldn’t very strongly recommend against all use of that function, and many prominent WordPress developers and WordPress Core devs would say and do say the same. The … Read more

how to separate categories in loop.php?

Here is something i have used recently… not too complicated… First.. we call all categories. Then.. we get posts inside each category using foreach <?php $allcats = get_categories(‘child_of=”.get_query_var(“cat’)); foreach ($allcats as $cat) : $args = array( ‘posts_per_page’ => 3, // max number of post per category ‘category__in’ => array($cat->term_id) ); $customInCatQuery = new WP_Query($args); if … Read more

delete category name in the pages

What theme are you running? Are you referring to Pages or Posts because they are two different types or rather, what we call Post Types. Pages are normally controlled via your page.php template file Posts are normally controlled via your single.php template file Commonly you will find category and tag functions in your single.php file, … Read more

How to add orderby parameter for sorting on category.php

You can use the pre_get_posts action hook to set the order on your category archive like so: add_action(‘pre_get_posts’, ‘filter_category_orderby’); function filter_category_orderby( $query ){ if( $query->is_category()){ $query->set(‘orderby’, ‘title’); } } just paste this snippet in your theme’s functions.php and you should be fine.

How to do paging in the loop?

Try adding ‘paged’ => get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1, // this will get the right posts for the current page (i.e. if the user loads www.domain.com/blog/page/2 directly) ‘posts_per_page’ => ‘6’ to your $args and delete showposts showpostsis deprecated. From the Codex reference for WP_Query: showposts (int) – number of posts to … Read more