我有多个自定义帖子类型,我需要能够查询它们并通过它们进行分页。这是我正在尝试的查询:
$paged = ( get_query_var( \'paged\' ) ) ? get_query_var( \'paged\' ) : 1;
$offset = ( 10 * $paged ) - 10;
$args=array(\'paged\'=>$paged, \'posts_per_page\'=>10, \'post_type\'=>\'custom-post-type-name\', \'offset\' => $offset);
query_posts($args);
我已经重置了永久链接,我已经将WordPress每页的帖子数设置为比我查询的更少的数字,当我转到/page/2/时,我得到的是404/(我的永久链接设置为
/%postname%-%post_id%
).
但最令人困惑的是,在单独的一页上,以下内容有效:
SELECT *, IFNULL(SUM(vote),0) as total FROM wp_posts post LEFT JOIN wp_wdpv_post_votes votes ON votes.post_id = post.ID WHERE post.post_type = \'custom-post-type-name\' AND post.post_status = \'publish\' AND post.post_date > DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY post.ID ORDER BY total DESC LIMIT 0,3
但是下面的404问题也是一样的
SELECT *, IFNULL(SUM(vote),0) as total FROM wp_terms term JOIN wp_term_taxonomy taxonomy JOIN wp_term_relationships relationship JOIN wp_posts post LEFT JOIN wp_wdpv_post_votes votes ON votes.post_id = post.ID WHERE term.term_id = taxonomy.term_id AND relationship.term_taxonomy_id = taxonomy.term_taxonomy_id AND term.slug = \'games\' AND taxonomy.taxonomy = \'category\' AND post.ID = relationship.object_id AND post.post_type = \'custom-post-type-name\' AND post.post_status = \'publish\' AND post.post_date > DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY post.ID ORDER BY total DESC LIMIT 0,3
在此方面的任何帮助都将不胜感激。