您好,我已经创建了自定义帖子类型和自定义分类法。自定义帖子类型页面名为page portfolio。php。我在其中创建了一个循环,我试图链接到每个帖子的单个页面。为此,我创建了一个单一投资组合模板。php,但由于某种原因,当我单击永久链接时,我会被发送到404。php页面。这是我的整个结构代码:
//custom post type and taxonomy declaration
<?php
add_action(\'init\' , \'portfolio_manager\');
function portfolio_manager(){
$args = array(
\'label\' => \'Portfolio Manager\',
\'singular_label\' => \'Portfolio Manager\',
\'public\' => true,
\'show_ui\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'supports\' => array(\'title\' , \'editor\' , \'thumbnail\'),
\'rewrite\' => array(
\'slug\' => \'portfolio\',
\'with_front\' =>false
)
);
register_post_type(\'portfolio\' , $args);
}
add_action(\'init\' , \'portfolio_taxonomy\');
function portfolio_taxonomy(){
register_taxonomy("portfolio-type",
array("portfolio"),
array("hierarchical" => true,
"label" => "Portfolio Types",
"singular_label" => "Portfolip Type",
"rewrite" => true,
"slug" => \'portfolio-type\'
)
);
}
?>
//page-portfolio.php loop
$portfolio = new WP_Query(array(
\'post_type\'=>\'portfolio\',
\'posts_per_page\'=>\'-1\'
));
while($portfolio->have_posts()): $portfolio->the_post();
global $post;
?>
<li class ="item" data-type="<?php echo str_replace(" " , "" , strip_tags(get_the_term_list($post->ID, \'portfolio-type\' , \'\' , \'\' , \'\'))); ?>" data-id="id-<?php the_ID(); ?>">
<span><a href="<?php the_permalink(); ?>">Details</a></span>
<?php
endif
?>
</li>
<?php
endwhile;
?>
如果是单一投资组合。php不是我应该为这个页面创建的页面模板,那么什么是corect模板?
如果是单一投资组合。php是corect模板,那么我在这里做错了什么呢。为什么permalink不让我单身呢。文件夹php?