How do I get the title of a category in a custom loop?

Since you already have the category ID (you use it in your call to WP_Query::query()), you can just use that to request the category name. get_cat_name( $cat_id ) will do exactly that. It uses get_category( $cat_id ) in the background, which returns the full category object, which can be useful if you want to show … Read more

Custom Query num_rows returns wrong amount

If you want the total count of all the published posts in a particular category you can try this. $all_posts = new WP_Query( array( ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’, ‘cat’ => 3 ) ); echo $all_posts->post_count; or $all_posts = new WP_Query( array( ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’, ‘category_name’ => ‘uncategorized’ ) ); echo … Read more

Order by title without taking into account ‘the’

If you’re using the plugin SEO Ultimate (it’s popular and I recommend using it), it has a component called Slug Optimizer that strips those types of words out of the post-slug, so if the post title is “The Dandy Warhols”, the slug would just be “dandy-warhols”. Perhaps just order by the post-slug?