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>

1 Answer 1

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; ?>
1
  • I'll give it a shot and let you know!
    – Vince P
    Commented Feb 24, 2012 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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