the_content()
does not grab the PHP file content.php
, it simply displays a Post’s content. Likewise, the_excerpt()
grabs the excerpt of a post.
get_template_part
simply finds a file within your theme named whatever you put in, with an optional suffix.
get_template_part( 'content' ); // content.php
get_template_part( 'content', 'my_page' ); // content-my_page.php
in order for make different displays for Gallery, Aside, etc. do this in single.php
get_template_part( 'content', get_post_format() );
It will point to content-gallery.php
, content-aside.php
, etc. with a fallback of content.php
if the file specified is not defined.
Edit:
All you need to do here is restructure your content-{post-format}.php
files. Inside those, use the_content()
, and create excerpt-{post-format}.php
files where you can then use the_excerpt()
.
Then your call in index.php
would be get_template_part( 'excerpt', get_post_format() )
, where inside your single.php
it would be get_template_part( 'content', get_post_format() )