Wordpress Hide Empty Navigation Div


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* in functions.php */
  2. function show_posts_nav() {
  3. global $wp_query;
  4. return ($wp_query->max_num_pages > 1);
  5. }
  6.  
  7. /* in template */
  8. <?php if (show_posts_nav()) : ?>
  9. <div id="nav-above" class="navigation">...</div>
  10. <?php endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.