WordPress.org

Support

Support » How-To and Troubleshooting » pagination does not work with query_posts. Help!

pagination does not work with query_posts. Help!

  • I made ​​a separate page template (added sidebar), this page contains all the posts. Pagination works!
    But, if this page set as the home page, pagination is not working!
    Please help find solutions myself I can not …

    This my code

    <?php
    /*
    Template Name: Шаблон страницы с сайдбаром
    */
    
    ?>
    
     <?php get_header () ; ?>
    
     <div id="container" class="cf">
    <h1 class="cat-title"> <?php single_cat_title(); ?> </h1>
    <?php query_posts( array('showposts' => 0, 'paged' => get_query_var('paged') ) ); ?>
    	 <?php if (have_posts()) : while (have_posts()) : the_post();?>
    
     <div class="post post-left">
    
    <div class="post-image">
    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
    </div>
    		   <h1 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="К посту <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
    
              		  <div class="entry-content">
              <?php the_content(); ?>
    
    		  <div class="entry-readmore"><a href="<?php the_permalink(); ?>" class="more-link">Читать полностью</a></div>
    		  </div>
           <div class="entry-meta">
    	<div class="meta-inner">
            <span class="date">
                <strong class="day"><?php the_time('d') ?></strong>
                <div class="holder">
                    <div class="month"><?php the_time('M') ?></div>
                    <div class="year"><?php the_time('Y') ?></div>
                </div>
            </span>
            <span class="author">
                <strong class="title">АВТОР</strong><br />
                <?php the_author_posts_link() ?>        </span>
            <span class="cat">
                <strong class="title">РУБРИКА</strong><br />
            <?php the_category(); ?>      </span>
            <span class="Tags">
                <strong class="title">МЕТКИ</strong><br />
               <?php the_tags(''); ?></span>
                        <span class="comments">
                    <strong class="title">КОММЕНТАРИИ</strong><br>
                    <?php comments_popup_link( 'Комментариев нет', '1 комментарий', '% штука', 'comments-link', 'Админ закрыл напрочь комментирование'); ?>         </span>
                </div>
    
    </div>
    </div>
    <?php get_sidebar('Sidebar'); ?>
    		 <?php endwhile; ?>
    
    		 <div class='pagination'>
    		 <?php my_pagination(); ?>
    		 </div>
    
             <?php endif; ?>
    <?php wp_reset_query(); ?>
    
    	 </div>
    	 <?php get_footer () ; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pagination does not work with query_posts. Help!’ is closed to new replies.
Skip to toolbar