How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?

ok, this is my working solution: <?php $args=array( ‘post_type’ => ‘biblioteka’, ‘child_of’ => 0, ‘parent’ => ”, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ‘hierarchical’ => 1, ‘exclude’ => ”, ‘include’ => ”, ‘number’ => ”, ‘taxonomy’ => ‘kategoria-pozycji’, ‘pad_counts’ => false ); $categories=get_categories($args); foreach ( $categories as $category ) { if ( … Read more

How do I Make a custom post type get a custom post template in a plugin

function get_custom_post_type_template($single_template) { global $post; if ($post->post_type == ‘events’) { $single_template = dirname( __FILE__ ) . ‘/single-event.php’; } return $single_template; } add_filter( ‘single_template’, ‘get_custom_post_type_template’ ); Source Or you could use: add_filter( ‘template_include’, ‘single_event_template’, 99 ); function single_event_template( $template ) { if ( is_singular(‘event’) ) { $new_template = locate_template( array( ‘single-event.php’ ) ); if ( ” … Read more