[英]Custom page template pagination not working when permalink structure is changed
I created a page template at http://www.durgeshsound.com/gallery/ Here my pagination buttons are not working. 我在http://www.durgeshsound.com/gallery/上创建了一个页面模板,这里的分页按钮不起作用。 this issue arises when permalink format is http://www.testsite.com/sample-post/ But when I set permalink format to default for example http://testsite.com/?p=123 then it starts working and creates a working pagination link like this http://www.durgeshsound.com/?page_id=81&paged=2 .
当永久链接格式为http://www.testsite.com/sample-post/时会出现此问题,但是当我将永久链接格式设置为默认值(例如http://testsite.com/?p=123)时,它将开始工作并创建一个像这样的工作分页链接http://www.durgeshsound.com/?page_id=81&paged=2 。
I want this format http://www.testsite.com/sample-post/ in the links. 我想要链接中的这种格式http://www.testsite.com/sample-post/ 。
here is what i tried for custom page template 这是我尝试的自定义页面模板
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('post_type=gallery&posts_per_page=9&paged=' . $paged); ?>
<?php if (have_posts()) : while (have_posts()) : the_post();
if ( get_post_gallery() ) :
$gallery = get_post_gallery( get_the_ID(), false );
?>
<?php the_post_thumbnail('large'); ?>
<?php the_title( ); ?>
<?php
endif;
endwhile; endif;
?>
<?php kriesi_pagination(); ?>
<?php get_sidebar('gallery'); ?>
<?php get_footer(); ?>
Please help. 请帮忙。
Below is custom Page : Replace $cat with your resp. 以下是自定义页面:用您的响应替换$ cat。 ID
ID
<ul class="clearfix">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$recentPosts = new WP_Query();
$recentPosts->query("cat=$cat&showposts=10&paged=".$paged); ?>
<?php if($recentPosts){ ?>
<?php if ( $recentPosts->have_posts() ): while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<li id="post-<?php the_ID(); ?>" <?php post_class('interview-list'); ?>>
<div class="video-thumb">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if(has_post_thumbnail()) {
the_post_thumbnail(array(500,393));
}else {
echo '<img src="'.get_bloginfo("template_url").'/images/no-image.jpg" width="500px" height="393px"/>';
}
?> </a>
</div>
<div class="image-con">
<div class="int-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</div>
</div>
</li>
<?php endwhile; ?>
<?php else: ?>
<h2 class="post-title">No Photos</h2>
<?php endif; ?>
<div class="older-link"><?php next_posts_link('« Older Entries', $recentPosts->max_num_pages) ?></div>
<div class="newer-link"><?php previous_posts_link('Newer Entries »') ?></div>
<?php } ?>
</ul>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.