Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

How to properly hide div when if have_post is empty.

$
0
0

Replies: 0

Hello everyone, it may be absurd to even ask because hiding a div is easy to do on loops,etc. However this time I’m not doing a while loop, instead I’m doing something more like just a “check if” on my front-page file, and it is not working there.

Here is my code:


<!-- Page content -->
<?php if(have_posts()) : the_post(); ?>
<div class="container-fluid" id="kevin_container">
<div class="row">
<div class="container" id="kevin_page_container">
<!------ Child Pages and Parent Page --->
<?php if(page_is_parent() || $post->post_parent > 0) : ?>
<div class="pagination pull-right">
<li>
<span class="parent-link">
<a href="<?php echo get_the_permalink(get_top_parent()); ?>"><?php echo get_the_title(get_top_parent()); ?></a>
</span>
<?php
$args = array(
'child_of' => get_top_parent(),
'title_li' => ''
);
?>
<?php wp_list_pages($args); ?>
</li>
</div>
<div class="clearfix"></div>
<?php endif; ?>
<article>
<?php the_content(); ?>
</article>
</div>
</div>
</div>
<?php endif; ?>

I would like to say that I’m trying to show content from a page, not a post.

Thanks


Viewing all articles
Browse latest Browse all 59525

Trending Articles