Support » Plugins » [Plugin: Yet Another Related Posts Plugin] if statement

  • h4ck0r86


    Is it possible to check and see if there are any related posts?

    I’m displaying the related post results in a new table below the article and would like to wrap it in a PHP if statement that only displays the table if there are articles returned.


Viewing 1 replies (of 1 total)
  • @h4ck0r86 – the easy way to do this is to simply enter what you’d like printed when you have no results into the “Default display if no results” option (including nothing, if you want nothing printed in that case) and similarly play with the before/after related entry/each post settings. The “display code example” on the right side will help you taylor these settings to your needs.

    If you require some PHP in your if block, you can use the function related_posts_exist() which returns true or false and then print related_posts() inside that code block. Remember if you decide to go this route to then turn off the “automatically display related posts” option.

    Thanks for trying out YARPP!


Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] if statement’ is closed to new replies.