我一直在抨击我的头靠在墙上试图弄清楚这一点,但似乎无法得到解决方案。我有偏移量定义为0,但在我的分页链接偏移+ 1的旧帖子只是导致错误页面。不确定我要去哪里错。任何帮助,将不胜感激。破碎的分页
这是所有从我的page.php文件文件中的代码...
<?php
$offset = $_GET['offset'] ? $_GET['offset'] : 0;
$page_title = $wp_query->post->post_title;
$total_posts = wp_count_posts()->publish;
if ($page_title == "Blog") {
?>
<div id="blog_content">
<?php
if($_GET['message']){
echo "<div style='background-color:#d9ffd1; padding:10px; margin-bottom:20px;'>".stripslashes($_GET["message"])."</div>";
}
?>
<?php
$post_count = 0;
$args = array('numberposts' => 10, 'post_status' => "publish", "offset"=>$offset*10);
$myposts = get_posts($args);
foreach($myposts as $post) : setup_postdata($post); $post_count++; ?>
然后我的分页链接
<div style="font-size:12px;">
<div style="float:left; width:49%;">
<?php
the_post();
if ($offset > 0): ?>
<a href="<?php the_permalink()?>&offset=<?=$offset-1?>">← Newer Posts</a>
<?php endif; ?>
</div>
<div style="float:right; width:49%; text-align: right;">
<?php
$next_post = get_next_post();
if ($total_posts > $post_count + ($offset*10)): ?>
<a href="<?php the_permalink()?>&offset=<?=$offset+1?>">Older Posts →</a>
<?php endif; ?>
</div>
<div style="clear:both;"></div>
</div>
预先感谢任何帮助任何人都可以提供
占定制只是出于好奇,你为什么不发布这个到'http:// wordpress.stackexchange.com /' – zipzit 2014-09-01 05:50:03
需要更多信息,错误页面是什么?错误页面的网址是什么? – Mattigins 2014-09-01 05:50:09
题外话,属于http://wordpress.stackexchange.com。 *旁注:*为什么在同一个HTML中使用单引号和双引号? – Raptor 2014-09-01 05:52:34