Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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; ?>
share|improve this answer
    
I'll give it a shot and let you know! –  Vince Pettit Feb 24 '12 at 9:26
    
Works perfectly, thanks! –  Vince Pettit Feb 24 '12 at 9:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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