Stuck tags in template
Hi guys, for some reason, the tags in all my articles are stuck.
When I say stuck, they’re showing the tags for one particular article in all other articles.
I’ve swapped code around from my other blog, but no avail.
The code for the tags is:
the_tags( '<p>Tags: ', ', ', '</p>');
Any ideas would great!
Might paste your index.php at a pastebin such as http://wordpress.pastebin.com/ and report the link back here.
Hi Michael, it’s not index.php, it’s single.php.
As requested, here’s the code from Paste Bin.
You mean the one at the top and the main one for the content?
I use the same thing on Blah without any problems and there’s no rewind template tag being used.
I’ve removed the loop from the top of the single.php file and it’s not changed anything.
Wonder if something in your sidebar.php is resetting your post loop?
If you change to the WordPress Default theme do you see the correct tags when viewing a single post?
Yes, changing the template does make the tags load properly.
BTW, thanks for your help so far! Much appreciated…
See if this works in your sidebar.php: (didn’t test this)
<?php global $post; $myposts = get_posts('numberposts=5'); foreach($myposts as $post): ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?>
<?php $recent= new WP_Query('numberposts=5'); while ($recent->have_posts()) : $recent->the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?>
Wayne what does the oil_am_Display(); function do? I don’t see anything weird in the sidebar file. What are the two loops actually accomplishing?
Hi Michael, the tags are still stuck, but this time they’re from a much earlier article. Also, it ignores the number of articles to be viewed in the query.
So the problem is clearly related to the Recent Articles, because when I take the code out, all is fine.
Hi Chris! That’s a function my Ask Me! Plugin uses.
But that’s been disabled, so it wouldn’t have done anything.
So right now, I’m using:
<?php foreach(get_posts('numberposts=5') as $post): ?> li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <php endforeach; ?>
I just don’t know enough about WordPress to figure this one out, despite all my PHP know-how…
Sorry, the numberposts=5 should be showposts=5. But you might want to try a new WP_query on your other loops.
- The topic ‘Stuck tags in template’ is closed to new replies.