mercredi 12 décembre 2018

if else loop for post count 0 and >0 with div

I've got the following, which is correctly displaying the response ("1 responses to this piece") when there are child posts. When there are no child posts, I need it to remove the div with the h3 tag "responses to this piece". It shows up as a paragraph in the previous div. Any thoughts?

I've tried to add an ifelse statement where have_posts() = 0). So far, this has not worked.

                <div>
                <?php if ($count = $child_query->have_posts() > 0) 
                     { ?>
                        <div class="responses-to-piece lemonde"><h3>
                        <?php echo $count; 'Responses to this piece';}
                    ?> Responses to this piece</h3></div>

Aucun commentaire:

Enregistrer un commentaire