allenwan / thematic

Automatically exported from code.google.com/p/thematic
0 stars 0 forks source link

in_the_loop() not resetted after the loop #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For reproduction, enable the following filter:

function bug_footer_in_the_loop() {
echo '<div>Still in the loop? '.in_the_loop().'</div>';
}
add_action('wp_footer', 'bug_footer_in_the_loop');

in_the_loop() should return 0 if called within sidebars, footers, etc. Instead, 
1 is returned still in the footer. This is only happening when using thematic 
theme.

Thematic version: 0.9.7.7
Wordpress version: 3.3.1

Original issue reported on code.google.com by matthes....@gmail.com on 14 Feb 2012 at 3:42

GoogleCodeExporter commented 9 years ago
I have tested and can confirm this. To be precise, it only occurs on pages and 
single post views. This is because these loops are not  wrapped in  "while ( 
have_posts() ) : the_post(); " but only calling the_post directly.

Made a patch to address this, which works on my install. Double check if I 
missed somewhere else, but I think these are the only two places this occur.

Original comment by invistr...@gmail.com on 14 Feb 2012 at 4:22

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
r837 fixes the page templates.  Just saw your comment middlesister.  I didn't 
look into the single. good catch

Original comment by eugene.m...@gmail.com on 14 Feb 2012 at 5:25

GoogleCodeExporter commented 9 years ago
Oh god, now I see more. There are some messy templates w/ bad comment handling 
going on. I'll get deeper into this later tonight.

Original comment by eugene.m...@gmail.com on 14 Feb 2012 at 5:25

GoogleCodeExporter commented 9 years ago
Please test against with a rev > r839

This commit does have an effect on the archive.php template hierarchy. The h1's 
are now out of  the loop.  I think that's acceptable. Any thoughts on this 
effect?

Thanks

Original comment by eugene.m...@gmail.com on 14 Feb 2012 at 10:47

GoogleCodeExporter commented 9 years ago
I tested it with r839 and all looks fine. my widget in the primary aside is not 
in the loop any longer. Thanks for the quick work!

Original comment by matthes....@gmail.com on 15 Feb 2012 at 9:44

GoogleCodeExporter commented 9 years ago
Great.

Thank you.

Original comment by eugene.m...@gmail.com on 15 Feb 2012 at 3:40

GoogleCodeExporter commented 9 years ago
I know that in the author template, one reason for calling the_post() before 
the page title was because  thematic_page_title used that information to fetch 
the author name.

This is no longer the case, since now a parameter is sent to

get_the_author_meta( 'display_name', $post->post_author );

BUT - since the_post is no longer setup, the $authordata variable is no longer 
available for the author description/vCard on author archives. Why don't we 
just wrap the vCard creation bit in the_post/rewind_posts and then remove the 
rewind_posts() from the author loop in content-extensions.php. I would prefer 
to have it all in the same file so we know what is going on. 

I don't know if there are any other places where this technique was used, but 
things seem to work fine otherwise. The h1's in archive.php seems not to be 
affected anyway.

The only thing that strikes me as weird is ending the "page" loop on the 
archives.php in the middle of the entry-content div. Why not after the comments 
template like the rest of the templates? I doesn't seem to affect 
thematic_archives()  at all.

And while we are at it: why is this page template not called 
template-page-archives.php? And shouldn't we deprecate this one as well?

Original comment by invistr...@gmail.com on 15 Feb 2012 at 9:16

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for reviewing. All your points are spot on.

r840

Original comment by eugene.m...@gmail.com on 16 Feb 2012 at 8:22