• Hi All,

    I know this has been asked too many times so far, and trust me I’ve tried many options but I just can’t get it working.

    Pagination per category works fine, per tag, per pages, everywhere except on the home page that is static. Moreover, it is correctly counted and correct number of possible pages is given, but when you click next / number it just ends up on the front page again.

    I’m using Lensa theme from colorlabsproject, qTranslate plugin and site is available at:
    https://igor.stojakovic.net

    Here is my whole page with some tries that are commented out:

    <?php
    /*
    Template Name: Blog
    */
    ?>
    <?php get_header(); ?>
    <div class="row">
        <header class="page-heading block-background block-inner">
          <!-- <h3><?php wp_title(''); ?></h3> -->
          <h3><?php _e("<!--:en-->Hi There<!--:--><!--:hr-->Ciao, zdravo, dobar dan :) <!--:-->"); ?></h3>
    	  <div class="minimize"></div>
        </header><!-- .page-heading -->
    
        <div class="main-content block-background column col8">
          <div class="block-inner">
    	 <?php
    	  //$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    	  //$args = array(
    		//'posts_per_page' => 3,
    		//'post_type'=> 'post',
    		//'paged' => $paged
    		//);
    
    	  //query_posts(array('post_type' => 'post', 'paged'=>$paged));
    	  //query_posts( array( 'cat' => -0, 'paged'=> $paged ) ); //prvi pokusaj popravka paginacije
    	  // For some reason this always returns "else, and ends up on $paged=1.
    	  /*if ( get_query_var('paged') ) {
    			$paged = get_query_var('paged');
    		} elseif ( get_query_var('page') ) {
    			$paged = get_query_var('page');
    		} else {
    			$paged = 1;
    		}*/
    
    	  if ( get_query_var('paged') ) {
    			$paged = get_query_var('paged');
    		} elseif ( get_query_var('page') ) {
    			$paged = get_query_var('page');
    		} else {
    			$paged = 1;
    		}
    		query_posts( array( 'post_type' => 'post', 'paged' => $paged ) );
    
    	  if(have_posts()) : while(have_posts()): the_post();
    	 ?>
            <article class="entry-post">
    
              <header class="entry-header">
                <h2 class="entry-title"><a>"><?php the_title(); ?></a></h2>
    		    <?php colabs_post_meta(); ?>
              </header>
    
              <figure class="entry-media">
    			<?php
    					$single_top = get_post_custom_values("colabs_single_top");
    					if (($single_top[0]!='')||($single_top[0]=='none')){
    						if ($single_top[0]=='single_video'){
    							$embed = colabs_get_embed('colabs_embed',400,231,'single_video',$post->ID);
    							if ($embed!=''){
    								echo '<div class="single_video">'.$embed.'</div>';
    							}
    						}elseif($single_top[0]=='single_image'){
    							colabs_image('width=620&link=img');
    						}
    					}else{
    						colabs_image('width=620&link=img');
    					}
    			?>
              </figure><!-- .entry-media -->
    
              <div class="entry-content">
    			<?php colabs_custom_excerpt(); ?>
    			<p class="more"><a>"><?php _e("More","colabsthemes"); ?></a></p>
    		  </div><!-- .entry-content -->
    
            </article>
    
    	 <?php
    	  endwhile;
    	  colabs_pagenav();
    	  endif;
    	 ?>
          </div><!-- .block-inner -->
        </div><!-- .main-content -->
    
    	<?php get_sidebar(); ?>
    
      </div>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • Pagination Note: Use get_query_var(‘page’); if you want your query to work in a Page template that you’ve set as your static front page. The query variable ‘page’ also holds the pagenumber for a single paginated Post or Page that includes the
    <!–nextpage–> Quicktag in the post content.

    Display posts from current page on a static front page so use this one:

    $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
    $query = new WP_Query( array( 'paged' => $paged ) );

    After while look complete add wp_query_rest() also.

Viewing 1 replies (of 1 total)
  • The topic ‘Pagination on static home page not working’ is closed to new replies.