WordPress.org

Support

Support » How-To and Troubleshooting » Stuck tags in template

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.

    For instance, if you go to my hardening economy article and scroll down, you’ll see the tags: “learning, Organic Knowledge” but they’re only for the Organic Knowledge article.

    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!

Viewing 11 replies - 1 through 11 (of 11 total)
  • 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.

    Thanks!

    You have multiple loops in that code so assuming you want both you should use the rewind_posts template tag.

    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.

    Here’s the code for sidebar.php on Paste Bin

    BTW, thanks for your help so far! Much appreciated…

    See if this works in your sidebar.php: (didn’t test this)

    replace

    <?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; ?>

    with

    <?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.

    OK, doesn’t look like this is working.

    I might have to scrap the recent articles code, or find some new code.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Stuck tags in template’ is closed to new replies.
Skip to toolbar