1179 posts
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
mabuc says

Hello wordpress masters,

I need your help…
I have here a function of page pagination and all I want is not to display the div.pagination and Page 1 of 3 when the page is equal to 1

here’s my code:
function pagination() {  
        global $wp_query;
        $big = 999999999;
        echo "<div class="\"pagination" clear="">";
        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,
            'type' => 'list'
        ));
        echo "<span class="\"count\"">Page " . max(1, get_query_var('paged') ) . " of " . $wp_query->max_num_pages . "</span>";
        echo "</div>";
    }

I hope someone can help.. I’m using paginate_links. I also check codex about this function but can’t find any solutions.

thanks
mark

1179 posts
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
mabuc says

oh nevermind.. I got it sorted, maybe someone needs it ;)

function pagination() {  
        global $wp_query;
        $big = 999999999;
        if($wp_query->max_num_pages == '1' ) {
        }else {
            echo "<div class="\"pagination" clear="">";
        }
        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,
            'type' => 'list'
        ));
        if($wp_query->max_num_pages == '1' ) {
        }else {
            echo "<span class="\"count\"">Page " . max( 1, get_query_var('paged') ) . " of " . $wp_query->max_num_pages . "</span>";
            echo "</div>";
        }
    }
by
by
by
by
by
by