WordPress.org

Ready to get started?Download WordPress

Forums

The Loop Itself (4 posts)

  1. KidChino
    Member
    Posted 7 years ago #

    I'm working on installing the related posts plug in and the last step says:

    "Put <?php related_posts(); ?> somewhere in your WP loop."

    This is a very dumb question, but I don't exactly know what the loop is.

    Could you point me in the right direction?

    Thanks!

  2. Chris_K
    Member
    Posted 7 years ago #

    Certainly. Here's the documentation for it: The_Loop

    You'll find it in your theme's index.php. Many other theme files will likely have it as well (although, for that plugin, index.php and, if you have it, single.php are probably the two to focus on).

    here's a snippit from one of my themes:

    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this entry &raquo;
    '); ?>
    </div>'
    <div>
    <hr />
    Possibly Related Posts:

      <?php related_posts(); ?>

    </div>`

  3. KidChino
    Member
    Posted 7 years ago #

    Thanks Handy. That helps a lot. However, now once I have put this into the Loop, I get a related posts link for my "about" page at the bottom of the page.

    I believe that this normallly appears on the side rail...

    can you provide some guidance as to how I might fix this issue?

    Thanks!

  4. Chris_K
    Member
    Posted 7 years ago #

    Ah fun stuff.

    Apparently your theme uses index.php for Pages too.

    You'll want to use Conditional_Tags in that case.

    Perhaps wrap the

    <div>
    <hr />
    Possibly Related Posts:
    <?php related_posts(); ?>
    </div>

    in a is_single() or a not is_page() would work?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags