私はページphpクエリごとに9の投稿を設定しましたが、それは動作しません。カスタムテーマを使用しています。そして私がテーマを変更したとき、それはうまく機能しています。ページ5の項目ごとのブログ投稿を解決するにはどうすればいいですか?
回答:
回答№1は0ページ付けを使用してブログ投稿リストを表示するためのコード:
<?php
$paged = (get_query_var("paged")) ? get_query_var("paged") : 1;
query_posts(array(
"post_type" => "post", // You can add a custom post type if you like
"paged" => $paged,
"posts_per_page" => 10
));
if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php // post content goes here ?>
<?php endwhile; ?>
<?php my_pagination(); ?>
<?php else : ?>
<?php // no posts found message goes here ?>
<?php endif; ?>
これはあなたのために働くことを望みます。