我试图获得一个加载更多功能来处理存档页面上的自定义帖子类型。
我使用这个插件并对其进行了一些自定义,因此它可以与自定义的帖子类型配合使用。http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax/
当前分页不起作用,因此插件无法加载更多项目。上面写着“inbeeld/page/2/404(未找到)”。所以我的问题是,为什么分页不起作用?
这是register\\u post\\u类型代码。
$inbeeld_args = array(
\'label\' => __(\'In Beeld\'),
\'singular_label\' => __(\'In Beeld\'),
\'public\' => true,
\'query_var\' => true,
\'show_ui\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'rewrite\' => array("slug" => "inbeeld", \'with_front\'=> false, "pages" => true ),
\'has_archive\' => true,
\'supports\' => array(\'title\', \'editor\', \'taxonomy\', \'thumbnail\'),
\'taxonomies\' => array(\'teams\'),
\'add_new\' => _x(\'Nieuw\', \'In Beeld\'),
\'add_new_item\' => __(\'Voeg Nieuw In Beeld Toe\'),
\'edit_item\' => __(\'Bewerk In Beeld\'),
\'new_item\' => __(\'Nieuw In Beeld\'),
\'view_item\' => __(\'Bekijk In Beeld\'),
\'search_items\' => __(\'Doorzoek In Beeld\'),
\'not_found\' => __(\'No In Beeld found\'),
\'not_found_in_trash\' => __(\'No In Beeld found in Trash\'),
\'pages\' => true
);
register_post_type(\'inbeeld\',$inbeeld_args);
这是我的循环。我删除了一些与我的问题无关的代码。
<?php
$paged = get_query_var(\'paged\') ? get_query_var(\'paged\') : 1;
$query = new WP_query(array(\'post_type\' => \'inbeeld\',\'paged\' => $paged, \'posts_per_page\' => 2 ));
while ($query->have_posts()) : $query->the_post();
?>
<li>
<?php the_title(); ?>
</li>
<?php endwhile; wp_reset_query(); ?>