8 posts
  • Has been part of the Envato Community for over 3 years
  • Has collected 10+ items on Envato Market
Zooboxs89 says

Hello,

I’m in a bit of a mess here. I just bought a new theme and everything works fine except the pagination. When you click on page 2 or next it takes you back to the homepage. Does anyone know a way to get the pagination to work on a static home page? Please it would be much appreciated i’m losing my mind here lol :)

here’s the code

<!- PAGINATION ->
<?php global $wp_query; $big = 999999999; // need an unlikely integer echo pr_sa_paginate_links( array( ‘base’ => str_replace( $big, ‘ # ’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => ’?paged= # ’, ‘type’ => ‘list’, ‘next_text’ => __(‘Next’, ‘pr_sa_theme’), ‘prev_text’ => __(‘Previous’, ‘pr_sa_theme’), ‘current’ => max( 1, get_query_var(‘paged’) ), ‘total’ => $wp_query->max_num_pages ) ); ?>
<!- /PAGINATION ->

Thank you all

8 posts
  • Has collected 1+ items on Envato Market
  • Located in Italy
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 1 year
SpaghettiThemes says

Hi, Your static page is a HTML Page ??? Because PHP don’t work on HTML page

370 posts
  • Has referred 50+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
PixelStores says

You could try…

<?php /* Template Name: Blog */ ?>

<?php get_header(); ?>

<?php query_posts('post_type=post&post_status=publish&posts_per_page=5&paged='. get_query_var('paged')); ?>
    <?php if( have_posts() ): ?>
        <?php while( have_posts() ): the_post(); ?>    
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>                        
        <?php endwhile; ?>
        <div id="wp_pagination">
            <?php global $wp_query; $big = 999999999; // need an unlikely integer
                echo paginate_links( array(
                    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
                    'format' => '?paged=%#%',
                    'current' => max( 1, get_query_var('paged') ),
                    'total' => $wp_query->max_num_pages,
                    'prev_text'    => __('«','pixelstores'),
                    'next_text'    => __('»','pixelstores'),
                )); 
            ?>
        </div>            
        <?php else: ?>
    <?php endif; ?>
<?php wp_reset_query(); ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

That there is a blog template :)

8 posts
  • Has been part of the Envato Community for over 3 years
  • Has collected 10+ items on Envato Market
Zooboxs89 says

You could try…
<?php /* Template Name: Blog */ ?>

<?php get_header(); ?>

<?php query_posts('post_type=post&post_status=publish&posts_per_page=5&paged='. get_query_var('paged')); ?>
    <?php if( have_posts() ): ?>
        <?php while( have_posts() ): the_post(); ?>    
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>                        
        <?php endwhile; ?>
        <div id="wp_pagination">
            <?php global $wp_query; $big = 999999999; // need an unlikely integer
                echo paginate_links( array(
                    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
                    'format' => '?paged=%#%',
                    'current' => max( 1, get_query_var('paged') ),
                    'total' => $wp_query->max_num_pages,
                    'prev_text'    => __('«','pixelstores'),
                    'next_text'    => __('»','pixelstores'),
                )); 
            ?>
        </div>            
        <?php else: ?>
    <?php endif; ?>
<?php wp_reset_query(); ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>
That there is a blog template :)

It didnt work pixelstores :crying:

by
by
by
by
by
by