0

I am creating one website from scratch, where I have to display Category description, how to hide the div, if there is no description written in backend for the post category?

my codes are:

<div class="row">
    <div class="col-sm-8 mx-auto py-5">
        <?php echo nl2br($qo->description) ?>
    </div>
</div>

I want to hide the entire row, if there is no description written in backend for the post category.

Thanks.

1 Answer 1

1

Wrap the div with a if condition like this. It should do the job!

<?php if($qo->description):?>
<div class="row">
    <div class="col-sm-8 mx-auto py-5">
        <?php echo nl2br($qo->description) ?>
    </div>
</div>
<?php endif; ?>

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.