How to show entries related to main category

There are a couple of problems with that code Selecting the wrong terms First of all, you are storing tags instead of categories in the $terms variable. The taxonomy name for categories is category. That line should look like this. $categories = get_the_terms( get_the_ID(), ‘category’); For sake of expresivity, I changed the $terms variable to … Read more

Regarding Tags And Categories

Based on the image you posted on your questions comments, I would assume the Videos, Blog, and Photos are custom post types registered by your current theme. The theme might also register some custom taxonomies for the post types. The post types and taxonomies could also be registered by some theme related plugin. You should … Read more

display current portfolio categories from a specific parent

$term_id = $current_term_id; $args = array( ‘hierarchical’ => 1, ‘taxonomy’ => ‘portfolio_category’, ‘hide_empty’ => 0, ‘parent’ => 6, ); $categories = get_categories($args); foreach($categories as $category) { if( $term_id != $category->cat_ID){ continue; } echo ‘<a href=”‘ . get_category_link($category->cat_ID) . ‘” title=”‘ . $category->name . ‘”>’ . $category->name . ‘</a><br>’; } I am assuming that you have … Read more

I want to create a custom taxonomy page showing a list of subcategories

Assuming the name of your custom post type is “videos”, you can create a new template file in the themes directory called taxonomy-videos.php. If your custom post type’s permalinks are set up correctly this template will be rendered anytime the main query returns ‘videos’, so at ‘http://www.yoursite.com/videos‘. In the template file you can start a … Read more