Check if post has a specific post type

First, check your syntax and ensure any comparison operators, escapes, and quotes are correct, and the statements are written properly based on the examples given in the codex. w3schools’ PHP Tutorial is a great starting point. Also, if your question provided the code you attempted to use with a conditional tag, it would be beneficial … Read more

Custom taxonomy template not working

First of all, a taxonomy-{taxonomy}.php file is an Archive Template and not a good name for a custom template. So if you want to proceed with a custom template, try naming the file with something like template-cities.php and call the file to a Page. Otherwise, make a simple taxonomy-{taxonomy}.php archive template, and in your case … Read more

Include different loop templates in search query

I would recommend using content-{posttype}.php method, where you only have HTML markup, template tags for posts or custom post types and leave loops outside of those files. See Twenty Eleven for more detailed example. After this change you can easily modify search.php and include specific content markup based on post type. if ( have_posts() ) … Read more

Child and grandchild taxonomy listings – 404

Solved by adding a filter and building the permalink. FIrt forget the pastebin code, just create a post type a nd the taxos you want, them add the filter: add_filter(‘post_link’, ‘territorio_permalink’, 10, 3); add_filter(‘post_type_link’, ‘territorio_permalink’, 10, 3); function territorio_permalink($permalink, $post_id, $leavename) { if (strpos($permalink, ‘%territorio%’) === FALSE) return $permalink; // Get post $post = get_post($post_id); … Read more

Custom Taxonomy returns no posts

Finally I’ve figured it out, I didn’t elaborate on this in my question but I had exclude_from_search set to true on register_post_type which is obviously why no posts were being displayed in the taxonomy-video_category.php template file. Changed it to false and posts are now displayed. // … $args = array( ‘labels’ => $labels, ‘description’ => … Read more