get_template_part for get_post_format() not working
-
Hi,
As simple as this might seem, am not able to get it to work.What i need is
get_template_part( 'content', get_post_format() );
to pick up content-image.php for image post-format.I have added theme support in functions file:
add_theme_support( 'post-formats', array( 'image', 'video', 'gallery', 'aside', 'quote', 'link', 'status', 'audio', 'chat' ) );
and this is my single.php loop:
<?php if ( have_posts() ) { while ( have_posts() ) : the_post(); // Start the loop if ( is_single() ) { echo 'single'; get_template_part( 'partials/content', 'single' ); } else { echo 'post-format'; get_template_part( 'partials/content', get_post_format() ); } endwhile; /* End the loop */ } else { ...
I publish a new post and choose format as ‘image’ from RHS radio-button.
But while viewing it, it goes to content-single.php instead of content-image.php code.
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_template_part for get_post_format() not working’ is closed to new replies.