簡體   English   中英

更改永久鏈接結構時,自定義頁面模板分頁不起作用

[英]Custom page template pagination not working when permalink structure is changed

我在http://www.durgeshsound.com/gallery/上創建了一個頁面模板,這里的分頁按鈕不起作用。 當永久鏈接格式為http://www.testsite.com/sample-post/時會出現此問題,但是當我將永久鏈接格式設置為默認值(例如http://testsite.com/?p=123)時,它將開始工作並創建一個像這樣的工作分頁鏈接http://www.durgeshsound.com/?page_id=81&paged=2

我想要鏈接中的這種格式http://www.testsite.com/sample-post/

這是我嘗試的自定義頁面模板

<?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(); ?>

請幫忙。

以下是自定義頁面:用您的響應替換$ cat。 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('&laquo; Older Entries', $recentPosts->max_num_pages) ?></div>
<div class="newer-link"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
<?php } ?>
</ul>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM