Opened 8 years ago
Closed 8 years ago
#39147 closed defect (bug) (invalid)
Single.php and post formats - wrong content
Reported by: | gwgw | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7 |
Component: | Post Formats | Keywords: | |
Focuses: | Cc: |
Description
In my single.php file i'm trying to get content, for specific post format using get_teplate part.
Example, single.php file:
get_template_part( 'template-parts/single-post/content',get_post_format() );
In my template-parts/single-post subfolder i have:
content.php - for standard posts, content-aside.php for aside and so on...
In this files i'm using:
the_content();
To get content from database...and its not work,
when i use the_excerpt();
i'm getting excerpt from previous post, not the current one.
Now, not-funny thing:
When i delete single.php and use index.php with:
get_template_part( 'template-parts/single-post/content',get_post_format() );
Everything works fine, i get proper content for proper post format,
its like i can't use: get_post_format() inside single.php
Is it bug, or only custom theme problem?
Hi @gwgw. Welcome to WordPress Trac.
This isn't the place for such support tickets. It may be that your template file is missing a call to
the_post()
, or a previous loop on the page is usingquery_posts()
and breaking things.You'd be best off posting on the support forums with some more information, possibly with a link to your complete template file.