我拼命想让我的自定义post-type归档页面上的分页正常工作,但每次单击时都会出现404错误<?php next_posts_link(\'« Older Entries\') ?>
对于结果的p2。
以下是我的情况:
我创建了一个名为“archive bvdirectory”的文件。php,用于我的自定义帖子类型“bvdirectory”(请参阅下面我如何在我的functions.php中进行设置)和“single bvdirectory”。php’用于查看单个自定义帖子,我可以很好地查看这两个帖子
我已经删除了我在阅读时永久创建的名为“目录”的页面,这可能会导致WP的重写规则出现问题(URL应该是相同的,这样才有意义)我已经无限刷新了我的永久链接,但它没有任何更改是否有人发现我的代码有问题,或者建议我尝试一下?
感谢您抽出时间,
Osu
CTP and taxonomies are set up like this:
function osu_bv_company() {
// Create Directory custom post type
register_post_type(
\'bvdirectory\',
array(
\'label\' => __( \'Directory\' ),
\'public\' => true,
\'has_archive\' => \'directory\',
\'show_ui\' => true,
\'query_var\' => true,
\'supports\' => array(
\'title\',
\'editor\',
\'author\',
\'excerpt\',
\'post-thumbnails\',
\'custom-fields\',
\'revisions\',
\'page-attributes\',
\'thumbnail\'
// \'trackbacks\',
// \'comments\'
),
\'rewrite\' => array(\'slug\'=>\'directory\')
)
);
// Create Industry taxonomy
$bvindustrylabels = array(
\'name\' => \'Industry\',
\'singular_name\' => \'Industry\',
\'search_items\' => \'Search industries\',
\'all_items\' => \'All industries\',
\'parent_item\' => \'Parent industry\',
\'edit_item\' => \'Edit industry\',
\'update_item\' => \'Update industry\',
\'add_new_item\' => \'Add new industry\',
\'new_item_name\' => \'New industry name\',
\'choose_from_most_used\' => \'Choose from most used industries\'
);
register_taxonomy(
\'bvindustry\',
\'bvdirectory\',
array(
\'hierarchical\' => true,
\'labels\' => $bvindustrylabels,
\'sort\' => true,
\'args\' => array(\'orderby\' => \'term_order\'),
\'rewrite\' => array(\'slug\' => \'industry\')
)
);
// Create Company Size taxonomy
$bvcosizelabels = array(
\'name\' => \'Company size\',
\'singular_name\' => \'Company size\',
\'search_items\' => \'Search company sizes\',
\'all_items\' => \'All company sizes\',
\'parent_item\' => \'Parent company size\',
\'edit_item\' => \'Edit company size\',
\'update_item\' => \'Update company size\',
\'add_new_item\' => \'Add new company size\',
\'new_item_name\' => \'New company name\',
\'choose_from_most_used\' => \'Choose from most used company sizes\'
);
register_taxonomy(
\'bvsize\',
\'bvdirectory\',
array(
\'hierarchical\' => true,
\'labels\' => $bvcosizelabels,
\'sort\' => true,
\'args\' => array(\'orderby\' => \'term_order\'),
\'rewrite\' => array(\'slug\' => \'size\')
)
);
}
add_action(\'init\', \'osu_bv_company\');
I have the following arguments set for my loop in archive-bvdirectory.php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$args = array(
// General args
\'post_type\' => \'bvdirectory\',
\'posts_per_page\' => 2,
\'orderby\' => \'title\', // set this in form
\'order\' => \'ASC\', // Set this in form
\'paged\' => $paged
);
// Filter posts
query_posts($args);