Forums

<?php the_tags('<p>Tags: ', ', ', '</p>'); ?> not working on wordpress 2.8 (9 posts)

  1. qqtechlu
    Member
    Posted 2 years ago #

    <?php the_tags('<p>Tags: ', ', ', '</p>'); ?>

    is not working on ttemplate file "single.php" i recently updated my blog to wordpress 2.8.

    I tried all PHP fuctions as mentioned over here http://codex.wordpress.org/Template_Tags/the_tags

    but still no success...I tried different themes also, upgraded to 2.8.1 beta-1 but still no solution :(

    Any help would be appreciated

  2. Christine
    Moderator
    Posted 2 years ago #

    A link to your site would help....

  3. crazybilly
    Member
    Posted 2 years ago #

    I just ran into a similar problem--using the_tags() just didn't show up.

    I found that I was using the Loop example from the Codex. If I replaced it with the one in the default theme, the_tags() started working.

    Originally, I had this:

    if ( $posts ) : foreach ( $posts as $post ) : start_wp();

    I replaced it with:

    if (have_posts()) :
    	while (have_posts()) : the_post();

    Of course, the bottom needed to be changed, as well, from an endeach to and endwhile.

    Worked for me.

  4. iSimone
    Member
    Posted 2 years ago #

    I've got the same problem in single.php:

    <?php the_tags('<p>Tags: ', ', ', '</p>'); ?>

    The above code does not output anything, whereas in index.php it does. Any ideas??

  5. jayroh
    Member
    Posted 2 years ago #

    In another thread I found a suitable answer to this -

    global $wp_query;
    $wp_query->in_the_loop = true;

    I have two loops on my index page and was running into this issue as well, no tags being spit out. Once I put the above before the second loop (the while loop), it worked.

    Hope this helps.

  6. Mark / t31os
    Moderator
    Posted 2 years ago #

    That's because the_tags() is a function for use in the loop...

    If you need to use it in a customised loop, or non-standard loop then you should use it's child/sister function get_the_tags and pass the necessary ID into the function...

  7. martyz
    Member
    Posted 2 years ago #

    That totally helped me. Thank you for posting that jayroh.

  8. inntell
    Member
    Posted 2 years ago #

    Thank you jayroh, I've just upgrade my wordpress. You're right, it worked.

    But I found some theme already updated with this issue.

    And this is my site

  9. duhdaniel
    Member
    Posted 2 years ago #

    Thank you jayroh :)

Topic Closed

This topic has been closed to new replies.

About this Topic