0

I'm using the Wordpress related plugin : http://wordpress.org/extend/plugins/related/

Which uses the following markup to call the plugin:

<?php echo $related->show(get_the_ID()); ?>

I would like to add a title and a division around the plugin... but would only like this to display if there is a related post/page. How should I modify the code?

This is the result I would like to see, but only when there is related content:

<div class="related"><strong>Related products</strong><br />
<?php echo $related->show(get_the_ID()); ?>
</div>
2

I don't know for sure if this would work but this is where I'd start:

<?php $related_content = $related->show(get_the_ID()); ?>
<?php if($related_content): ?>
    <div class="related"><strong>Related products</strong><br />
        <?php echo $related_content; ?>
    </div>
<?php endif; ?>
  • I'll give it a shot and let you know! – Vince Pettit Feb 24 '12 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.