2013-05-15 80 views
0

我不知道爲什麼頁面導航do not work correctly頁面導航無法找到第2頁

有超過8個帖子,但只顯示8個帖子。而我找不到頁碼「2」和文本「下一頁」。爲什麼?

<script> 
$(".m7").show(); 
</script><div class="ppddff" style="border-bottom:1px solid black; margin-bottom:2px;"> 
<?php if (have_posts()) : ?> 
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 

<link rel="image_src" href="http://www.wapsmag.com/wp-content/uploads/2013/02/blog_th.jpg" /> 

<script>(function(d, s, id) { 
    var js, fjs = d.getElementsByTagName(s)[0]; 
    if (d.getElementById(id)) return; 
    js = d.createElement(s); js.id = id; 
    js.src = "//connect.facebook.net/ko_KR/all.js#xfbml=1"; 
    fjs.parentNode.insertBefore(js, fjs); 
}(document, 'script', 'facebook-jssdk'));</script> 
<style> 
.blttl a{ font-family: 'Nanum Myeongjo','NanumMyeongjoExtraboldWeb', 맑은 고딕; color:#000;} 
.blttl a:hover { text-decoration:none; color:#000;} 
.tagstyle a{ font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕; color:#000;} 
.tagstyle a:hover { text-decoration:none; color:#000;} 
.ttop { background-color:black;} 
.pagg{padding-top:100px; padding-bottom:0px;} 
.catttl a { color:#000000; text-decoration:none; font-family:Georgia, "Times New Roman", Times, serif;} 
.catttl a:hover{text-decoration:underline;} 
.ttyyuu a { color:#000000; text-decoration:none; font-family:Georgia, "Times New Roman", Times, serif;} 
.ttyyuu a:hover{text-decoration:underline;} 
.subm a { margin:0 5px 0 5px; color:#666; text-decoration:none; font-family:Georgia, "Times New Roman", Times, serif;} 
.subm a:hover { color:#000000; text-decoration:underline;} 
.cover1 { display:none;} 
</style> 

<div style="width:100%; position:relative; overflow:hidden;"> 

<div style="width:900px; margin:20px auto; "> 
<div style="padding-bottom:20px; margin-bottom:20px; border-bottom:1px solid #666;"> 
<div style="width:150px; height:210px; float:left; margin-top:10px; margin-right:20px; position:relative;"><?php ciii_category_images(""); ?></div> 
<div style="width:730px; height:210px; float:left;"> 
<div class="blttl fvb" style="font-family: 'Nanum Myeongjo','NanumMyeongjoExtraboldWeb', 맑은 고딕, 'Georgia'; font-size:16pt; color:#000; padding-top:10px; margin-bottom:3px; text-align:left;" ><?php single_cat_title(); ?> </div> 
<div style="font-size:10pt; color:#999; text-align:left; font-family:Georgia, 'Times New Roman', Times, serif; "class="ttyyuu"> <?php echo category_description(); ?> 


</div> 
<div style="width:900px; margin:10px auto; position:relative; height:30px; text-align:center;"> 
<div class="addthis_toolbox addthis_default_style " style="text-align:center; padding-left:0px;"> 
<a class="addthis_button_favorites"></a> 
<a class="addthis_button_preferred_1"></a> 
<a class="addthis_button_preferred_2"></a> 
<a class="addthis_button_preferred_3"></a> 
<a class="addthis_button_preferred_4"></a> 
<a class="addthis_button_compact"></a> 

</div> 
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=xa-505280914104c869"></script> 
<script>$(".addthis_button_tweet").css("width","90"); </script> 
</div> 
</div> 
<div style="clear:both;"></div> 
</div> 


<?php while (have_posts()) : the_post(); ?> 



<div style="width:900px; margin:0 auto;"> 
<div style="width:900px; margin:0 auto; padding-top:20px; padding-bottom:10px; text-align:center; font-size:16pt; color:#000; font-family: 'Nanum Myeongjo','NanumMyeongjoExtraBoldWeb', 

맑은 고딕;"><?php the_title(); ?></div> 
<div style="width:900px; text-align:center; font-size:9pt; color:#999999; font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕;"><?php the_time(); ?></div> 
<div style="width:900px; margin:0 auto; line-height:1.8em; font-size:10pt; color:#666666; font-family: 'Nanum Gothic','NanumGothicWeb', 맑은 고딕; padding-bottom:30px;"><?php 

the_content(); ?> 

</div> 
<div style="width:900px; margin:0 auto; padding-top:20px; padding-bottom:20px; border-top:1px solid #CCC; border-bottom:1px solid #CCC; "> 
<div style="font-family:Georgia, 'Times New Roman', Times, serif; font-size:12pt; color:#000000; padding-bottom:5px; text-align:left;">Tag <img src="/tagg.jpg" /></div> 
<div class="tagstyle" style="font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕, 'Georgia'; font-size:10pt; color:#000; text-align:left;"><?php the_tags('<div 

class="tagstyle">', ', ', '</div>'); ?></div> 
</div><div style="height:0px;"></div> 
</div> 

<div class="blttl fvb" style="font-family: 'Nanum Myeongjo','NanumMyeongjoExtraboldWeb', 맑은 고딕, 'Gerogia'; font-size:16pt; color:#000; padding-top:10px; margin-bottom:3px; text- 

align:left;" > 


</div></div> 


<?php endwhile; ?> 
<div style="clear:both;"> 
</div> 
</div> 



<div style="padding-top:30px; border-top:1px solid black; width:900px; margin:0 auto;"><?php query_posts(array(
    'showposts' => 1, 
    'orderby' => 'rand', 
    'category_name' => 'sbanner' //You can insert any category name 
)); 
?> 
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <a href="<?php echo get_post_meta($post->ID, 'url', true) ?>" target="_new"/> <?php the_post_thumbnail(); ?></a> 
      <?php endwhile; endif; ?></div> 
    </div> 






<div class="navvi" style="padding-top:20px; padding-bottom:40px; width:900px; margin:0 auto;"><?php wp_pagenavi(); ?></div> 
<?php else : if (is_category()) { printf("<div class='center sorry' style='padding:150px 0 150px 0;'>Sorry, but there aren't any posts in the %s category yet.</div>", single_cat_title 

('',false));} endif; ?> 

</div> 
<style>.sorry {font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕; font-size:12pt;} 
.navvi a { color:#666666;} 
.navvi a:hover { color:#000000; text-decoration:underline;} 
</style> 
</div> 

回答

0

你在你的頁面做了第二個職位查詢,調用分頁插件,所以使用這個查詢,顯示的頁面,而不是第一/主的人之前。

<div style="padding-top:30px; border-top:1px solid black; width:900px; margin:0 auto;"> 
<?php query_posts(array(
    'showposts' => 1, 
    'orderby' => 'rand', 
    'category_name' => 'sbanner' //You can insert any category name 
)); 
?> 
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <a href="<?php echo get_post_meta($post->ID, 'url', true) ?>" target="_new"/> <?php the_post_thumbnail(); ?></a> 
      <?php endwhile; endif; ?></div> 
    </div> 

第二查詢之前,得到的wp_pagenavi()值(檢查此學習如何做到這一點:http://wordpress.org/support/topic/plugin-wp-pagenavi-returning-a-string-not-printing-it-directly

然後回顯這個值,你實際調用wp_pagenavi();