How to query for posts (hierarchical custom post type) that have children but are NOT top level?

You can use filters to modify the SQL. I added something unique in the post_type so I could filter only this query and not change anything else. The query for example $query = new WP_Query(array(‘post_type’=>’something_unique_for_filter’)); And the filter function custom_where($where, $query) { global $wpdb; if(false !== strpos($where, ‘something_unique_for_filter’)) { $where = ” AND post_type=”page” AND … Read more

Can I assign a Folder for Post Formats, without it affecting WordPress’ fallback/hierarchical system?

In general, “bad practice” is so common in the wordpress ecosystem, you will have to do something really bad for anyone to actually signal you out for doing it 😉 If you are the developer and maintainer of the theme, you should develop it in a way which will be easy for you to maintain … Read more

Creating a non-hierarchical Taxonomy that behaves like categories

This blog post by “Gazchap” deals with exactly the situation you are, and they updated it after publishing to your follow-up problem: Fortunately, version 4.4 of WordPress introduced a filter – post_edit_category_parent_dropdown_args – that could be used to control the parent terms shown in these meta boxes. It’s designed to let the developer change the … Read more

Display a specific hierarchical level of a specific custom taxonomy

Change: get_the_category() to get_the_terms( null, ‘taxonomy_name’ ). get_category_link( $cat->cat_ID ) to get_term_link( $cat->term_id ). get_category( $category->category_parent ) to get_term( $category->parent ). If you want to use the same function for multiple taxonomies, you can accept the taxonomy name as an argument and pass it to the first item above: function display_cat_level( $level = 0 , … Read more

Different layout on second page

To load override WordPress’ choice of template you can use template_include filter and then use the locate_template to return the the template file path (if it finds it). The file-name passed to locate_template must be the name of the template file name (which should be in you theme/child-theme directory). //Loads template customtemplate.php from your theme … Read more