• Hi,

    I have added tags to my blog posts and then added the following code to
    my while loop:

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

    only the first posts tags are shown

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Have you enabled debugging to see if there’s any kind of PHP error stopping it? Can you post the whole loop code or is it too large a loop?

    Oops, looks like I misunderstood your question that’s why I’ve deleted my response.

    Sorry!

    • This reply was modified 4 years, 6 months ago by George Appiah. Reason: Added text for clarity
    • This reply was modified 4 years, 6 months ago by George Appiah.
    Moderator bcworkz

    (@bcworkz)

    If you are running a non-standard loop which does not utilize the_post() to update post globals, then the_tags() will not be aware of additional posts.

    If that’s not it, please post your loop code. If it’s extensive, you can use pastebin.com or gist.github.com and just leave a link here.

    Thread Starter jmbiddulph

    (@jmbiddulph)

    Here is my loop

    <?php if ( have_posts() ) : $count = 0; while ( have_posts() ) : the_post(); $count++; ?>
        <section class="image-with-text">
            <div class="row blog-row">
                <?php if(($count % 2) == 0){ ?>
                    <div data-aos="fade-right" class="left text aos-init aos-animate">
                        <h1><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h1>
                        <?php if( get_field('sub_header') ): ?>
                            <h2><?php echo get_field('sub_header');?></h2>
                        <?php endif;?>
                        <?php the_tags('Tags: ', ', ', '<br />'); ?>
                        <!-- Go to www.addthis.com/dashboard to customize your tools -->
                        <div class="addthis_inline_share_toolbox"></div>
                        <?php the_excerpt(); ?>
                        <p><span style="text-decoration: underline;"><a href="<?php echo get_permalink(); ?>">Read More...</a></span></p>
                        <p>&nbsp;</p>
                    </div>
                    <div data-aos="fade-left"
                         class="right background-image aos-init lazyloaded aos-animate"
                         style="background-position: center center;
                                 background-image: url(<?php the_post_thumbnail_url(); ?>);"
                         data-bg="<?php the_post_thumbnail_url(); ?>">
                    </div>
                <?php } else{ ?>
                    <div data-aos="fade-right"
                         class="left background-image aos-init lazyloaded aos-animate"
                         style="background-position: center center;
                                 background-image: url(<?php the_post_thumbnail_url(); ?>);"
                         data-bg="<?php the_post_thumbnail_url(); ?>">
                    </div>
                    <div data-aos="fade-left" class="left text aos-init aos-animate">
                        <h1><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h1>
                        <?php if( get_field('sub_header') ): ?>
                            <h2><?php echo get_field('sub_header');?></h2>
                        <?php endif;?>
                        <?php the_tags('Tags: ', ', ', '<br />'); ?>
                        <!-- Go to www.addthis.com/dashboard to customize your tools -->
                        <div class="addthis_inline_share_toolbox"></div>
                        <?php the_excerpt(); ?>
                        <p><span style="text-decoration: underline;"><a href="<?php echo get_permalink(); ?>">Read More...</a></span></p>
                        <p>&nbsp;</p>
    <!--                    Link from global.js-->
    <!--                    <a href="https://www.pinterest.com/pin/create/button/?url=https%3A%2F%2Fwordpress-329752-1448773.cloudwaysapps.com%2Fblog%2F&media=https%3A%2F%2Fwordpress-329752-1448773.cloudwaysapps.com%2Fwp-content%2Fuploads%2F2020%2F06%2Fsustainable-fashion-bella-and-frank-1-scaled.jpg&description=%27" data-pin-do="buttonBookmark">-->
    <!--                        Pinit-->
    <!--                    </a>-->
    <!--                    plain link-->
    <!--                    <a href="https://www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark">-->
    <!--                    </a>-->
                    </div>
                <?php } ?>
            </div>
        </section>
        <section class="spacer"></section>
    <?php endwhile;?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘the_tags() only showing on first post in loop’ is closed to new replies.