• Hi All –

    So I’m using this for pagination:

    function html5wp_pagination()
    {
        global $wp_query;
        $big = 999999999;
        echo paginate_links(array(
            'base' => str_replace($big, '%#%', get_pagenum_link($big)),
            'format' => '?paged=%#%',
            'current' => max(1, get_query_var('paged')),
            'total' => $wp_query->max_num_pages
        ));
    }

    The only problem is that this creates an empty pagination div if there is no pagination. Is there an if argument I can use to not output the pagination div if there is no pagination?

    Thanks
    John

Viewing 1 replies (of 1 total)
  • Thread Starter john_harrison

    (@john_harrison)

    Got my answer…

    If anyone was wondering, just use this:

    <?php 
    
         global $paginated_query;
         global $wp_query;
    
         if ( !$paginated_query ):
          $paginated_query = $wp_query;
         endif;
    
         if ( $paginated_query->max_num_pages > 1 ) : ?>
Viewing 1 replies (of 1 total)
  • The topic ‘paginate_links’ is closed to new replies.