WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] [Plugin: Yet Another Related Posts Plugin] Related content show up twice (8 posts)

  1. rughooker
    Member
    Posted 2 years ago #

    This problem showed up after updating to WP 3.3

    I noticed that the block with Related posts was duplicating. In the plugin settings, the box to show related posts automatically was unchecked. I checked my single.php file and it showed
    <?php echo related_posts();?>
    This code only shows once. When I removed it, the related post content completely disappeared. If I checked the option to have this content added automatically while the code was deleted, it worked and only showed up once.

    Event though removing the code and using the automatic placement works, I want to control exactly where this content shows and prefer to use the code in single.php.

    Does anyone know why this is suddenly showing twice?

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

  2. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    There's no need to echo it. related_posts() already will echo its HTML. :)

  3. rughooker
    Member
    Posted 2 years ago #

    It worked. That's a lesson I'll remember. It took a couple of readings for it to sink in. In case anyone else is in the same boat:

    I changed:
    <?php echo related_posts();?>
    to
    <?php related_posts();?>

  4. ideaenergia
    Member
    Posted 2 years ago #

    hi, i have same problem with my blog. I see twice the "no related post" text, but in my single.php I dont have the string belov <?php echo related_posts();?>

    ples you want help me?

    thanks

  5. tracywongphoto
    Member
    Posted 2 years ago #

    Hi! I'm having the duplicate related posts problem on my blog:
    http://tracywongphoto.com/blog/

    The whole section of related posts is doubled. I've looked around the forums and tried flushing by adding &action=flush at the end of my YARPP settings url, but no luck.

    Checked my custom template and doesn't look like I have duplicate code.

    What else can I do? Please help.

  6. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    You most likely want to do the same as @rughooker... check where you are calling related_posts() in your own theme files, and make sure you're not echoing the result.

  7. tracywongphoto
    Member
    Posted 2 years ago #

    Thanks @mitcho. I just doubled checked and the code I had there was <?= related_posts(); "> so just changed it to exactly the way @rughooker had in the fix. Works now, thanks!

  8. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, <?= will end up printing the output. Glad you got it worked out! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic