• I need help with the pagination of my site, I am using this same code in index.php of my site, where it works correctly, but I want to put the page in specific posts of the site, and when I use the same code, only the first page of the page appears pagination.

    <?php
    						
    if(is_single(88) and !is_paged())
    						query_posts('category_name=fairy-tail&orderby=date&order=asc&showposts=100');
    					else						query_posts($query_string . '&category_name=fairy-tail &orderby=date&order=asc');
    					
    					$pg_pn = $wp_query->found_posts;
    					while (have_posts()) : the_post();
    
    					$tempo		= get_post_meta($post->ID, 'tempo', true);
    					$capa_src	= getImage2('1');
    					$capa_src	= str_replace('animesfusion.org/img', 'animesfusion.org/thumb/img', $capa_src);
    
    				?>
    				
    				<li>
    					<div class="box-episodio">
    					    <div class="nome-thumb">
    					    <a href="<?php the_permalink(); ?>" class="tt" title="<?php the_title(); ?>"><?php echo substr(strip_tags(get_the_title('')), 0, 55).(strlen(get_the_title('')) > 55 ? '&hellip;' : ''); ?></a>
    						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="thumb">
    							<?php if( $tempo ){ ?><span class="tempo"><?php echo $tempo; ?></span><?php } ?>
    							<img src="<?php echo $capa_src; ?>" class="img-full" title="<?php the_title(); ?>" alt="<?php the_title(); ?> - Assistir Animes Online"><span class="num-episodio">HD</span>
    						</a>
    						</div>
    						<!--/nome-thumb-->
    
    										<div class="lista-qualidade full-hidden">
    																																	<a class="titulo float-left active" data-tabl="mp4">SD</a>
    																																	<a class="titulo float-left active"  data-tabl="hd">HD</a>
    																																	<a class="titulo  hidden-xs active"  data-tabl="fullhd">FULL HD</a>
    																					</div>
                    <!--/lista-qualidade-->
    										<div class="lista-servers">
    																							<div class="content-servers relative item1 l-mp4 atual esconder" >
    													<ul>
    																										
    																											</ul>
    													<a href="<?php the_permalink(); ?>" title="ASSISTA ONLINE" class="btn-online">ASSISTA ONLINE</a>
    												</div>             												
    
    					
    					</div>
    				</li>
    				<?php
    					endwhile;
    					wp_reset_query();
    				?>
    
                  </ul>    
                  
                  			</div>
                             <?php if(function_exists('wp_paginacao')){ wp_paginacao($pg_pn); } ?>
    
    </div>

    As I said, the index of my site works perfectly, where I only change the is_single by is_home.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    index.php pagination works because the main query is able to pick up on the pagination parameter in the URL and adjust the query accordingly.

    In your posted code, query_posts() is used, which throws out the main query that handles pagination and runs its own query based on passed parameters. You’ve not included any paging parameters, so you get the same return every time.

    Additionally, a single page by definition cannot be paginated because there is only the one page, no others. I realize you want to paginate the query results and not the page, but this is how WP sees the situation. You will need to manage the pagination through your query yourself. WP doesn’t see that there is anything to paginate.

    Before getting into handling your own pagination, you shouldn’t be using query_posts() at all. Use either get_posts() or make a new WP_Query object.

    I suggest you avoid trying to utilize default WP pagination parameters. Use your own. A paginated link could be yayanimes.net/hack-sign/?pg=3 . Get the “pg” value from $_GET[‘pg’] and calculate the required query offset based on posts per page. Include these parameters in your query arguments and you have accomplished custom pagination.

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