我想知道为什么我的自定义帖子类型页面不接受分页页面?
在普通页面上,我可以列出自定义帖子类型,但在自定义帖子类型页面上,这似乎是不可能的。我想制作自定义列表页面,根据各种查询列出自定义帖子类型。
一、 e.如果我想在带有分页的页面上列出所有自定义帖子类型,URL或永久链接结构将如下所示:http://www.url.com/taxonomy/document/page/2/, 但我根本无法访问该页面,它只是将其他页面(如2、3、4等)重定向到根页面http://www.url.com/taxonomy/document/.
我尝试了我在网上找到的各种奇怪而奇妙的解决方案,但似乎没有任何解决方案?
我不想将标准页面与自定义模板一起使用的原因是,它需要特定的设置来设置搜索查询,而普通页面不应该这样做。
这是代码片段,它在自定义页面模板(template list.php)上完全可以正常工作,但在自定义post类型页面上则不行。
$entry = new ThemeOptions\\PropertyListing();
$max = get_option(\'posts_per_page\');
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$args = array(
\'post_type\' => \'property\',
\'posts_per_page\' => $max,
\'paged\' => $paged,
\'tax_query\' => \'\',
\'meta_query\' => \'\',
\'post_status\' => \'publish\',
\'orderby\' => \'\',
\'order\' => \'DESC\'
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while($query->have_posts()) : $query->the_post();
echo $entry->display($post);
endwhile;
$wp_query = $query;
get_template_part(\'/includes/layout/pagination\', \'\');
else:
echo "No posts found!! <br>";
endif;
这是我想列出其他帖子类型的自定义帖子类型,并且分页或分页页面失败。
[slug] => listing
[label] => Listing
[labels] => Array
(
[name] => Listings
[singular_name] => Listing
[menu_name] => Listings
[all_items] => Listings
[add_new] => Add New
[add_new_item] => Add New Listing
[edit] => Edit
[edit_item] => Edit Listing
[new_item] => New Listing
[view] => View Listing
[view_item] => View Listing
[search_items] => Search Listings
[not_found] => No Listings found
[not_found_in_trash] => No Listings found in Trash
[parent_item_colon] => Parent Listing
)
[description] => Listing page is a custom page type to store and display a search listing page.
[public] => 1
[exclude_from_search] => 1
[publicly_queryable] => 1
[show_ui] => 1
[show_in_nav_menus] => 1
[show_in_menu] => 1
[show_in_admin_bar] => 1
[menu_position] => 21
[menu_icon] => dashicons-admin-page
[capability_type] => listing
[capabilities] => Array
(
[read] => read
[edit_post] => edit_listing
[edit_posts] => edit_listings
[edit_others_posts] => edit_others_listings
[edit_private_posts] => edit_private_listings
[edit_published_posts] => edit_published_listings
[publish_posts] => publish_listings
[read_post] => read_listing
[read_private_posts] => read_private_listings
[delete_post] => delete_listing
[delete_posts] => delete_listings
[delete_others_posts] => delete_others_listings
[delete_private_posts] => delete_private_listings
[delete_published_posts] => delete_published_listings
)
[map_meta_cap] => 1
[hierarchical] =>
[register_meta_box_cb] =>
[has_archive] =>
[rewrite] => Array
(
[slug] => listing
)
[query_var] => 1
[can_export] => 1
[supports] => Array
(
[0] => title
[1] => editor
[2] => author
[3] => thumbnail
[4] => revisions
[5] => page-attributes
)
我不确定是否缺少允许分页的内容