나는 이것을 알아 내려고 벽에 머리를 내리려고했지만 해결책을 얻지 못하는 것 같습니다. 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
자세한 정보가 필요하면 오류 페이지 란 무엇입니까? 오류 페이지의 URL은 무엇입니까? – Mattigins
오프 주제, http://wordpress.stackexchange.com에 속함. * sidenote : * 왜 같은 HTML에서 작은 따옴표와 큰 따옴표를 사용합니까? – Raptor