Template for custom taxonomy for custom post type broken

From code for post type and custom taxonomy, your CPT is post_features and taxonomy is features. For single post_features, you need to have file named single-post_features.php. For archive, create file taxonomy-features.php. See documentation for detail. https://codex.wordpress.org/Post_Type_Templates Example for single(single-post_features.php): <?php get_header(); ?> <?php if ( have_posts() ) { while ( have_posts() ) { the_post(); the_title(); … Read more

Query only current post type using taxonomy

If you look at WordPress’ available query variables, you will notice post_type. You will need to add that to your URL: $terms = get_the_terms( $post->ID , ‘category’ ); foreach ( $terms as $term ) { $term_link = get_term_link( $term, ‘category’ ); if( is_wp_error( $term_link ) ) continue; $term_link = add_query_arg( array( ‘post_type’ => $post->post_type ), … Read more

How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?

It seems to me like this is just a regular addition to functions. Since you are asking, I think you may not be getting the result you are looking for. If this was my project, I would create a new plugin, install it into the regular plugin list so that it does not get overwritten … Read more

How do I get the index for a custom post?

For example if there are 10 custom posts, and No. 1 is the oldest, and they happened to select the 3rd oldest one, they want it to say “No. 3”. There is a more elegant way than that function: $args = array( ‘post_type’ => ‘book’, ‘fields’ => ‘ids’, ‘ignore_sticky_posts’ => true, ‘orderby’ => ‘post_date’, ‘order’ … Read more

Dynamic category name in query post

You shouldn’t use query_posts functions. You should create instance of WP_Query class In your theme folder create a new file called category-slug.php. You can copy the category.php file or archive.php file to create category-slug.php file. Then in the new category-slug.php file before the while loop you can write your query. $query = new WP_Query( ‘category_name=apple,pears’ … Read more