List of post categories only associated to another custom taxonomy

Here’s what I come up with, looks like it’s working. But maybe (surely) there’s a more efficient way to do the same: // current queried $term = ‘sector’; $current_sector_id = get_queried_object_id(); // Prepare wp_query to get all posts assigned to the current “sector” $sector_posts_query = new WP_Query(); $sector_posts_query->query( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, … Read more

How to add tags under categories

I believe the core issue here is that tags aren’t organized by categories. As far as WordPress is concerned, tags and categories don’t have a direct relationship with each other. They are simply different ways of organizing posts, where the key difference is that categories are hierarchical (there are parent categories and subcategories) and tags … Read more

Filtering blog posts by category

Ok, with a bit more digging, it seems there are two things I can do: Use the Categories menu option, which will then make use of the archive.php template – nice and easy. Use the WP_Query() function to make a direct DB query for a particular category .. I think this is exactly what I … Read more

Display all Categories

Function wp_list_categories has an argument echo with you have set to 1 (true). When if it is set to true, instead of returning the value, the function will output the content. Because nothing was returned the var_dump displays null. Change the echo to false in your arguments array to have the value returned.