【发布时间】:2014-09-29 01:10:16
【问题描述】:
所以我正在使用两种自定义帖子类型文章和新闻设置自定义 WordPress 主题。每个人还使用自定义single-post.php 页面single-articles.php 和single-news.php。但是,在主页上拉出文章帖子并将其永久链接插入“阅读更多”链接后,当我单击文章的一个链接时,它会将我带到他们的永久链接 URL,但不是显示文章帖子,而是显示新闻帖子内容. single-articles.php 和 single-news.php 都在主题文件夹中,而不是在子文件夹中。
这是我如何设置自定义帖子的示例...
add_action( 'init', 'articles_custom_postypes' );
function articles_custom_postypes() {
$args = array (
'label' => $labels,
'public' => true,
'menu_position' => 100,
'menu_icon' => 'dashicons-format-aside',
'label' => 'Articles',
'has_archive' => false,
'supports' => array( 'title','editor', 'thumbnail'),
);
register_post_type( 'articles', $args);
}
在自定义单个帖子页面上,我只是调用the_title()、the_content 等。我应该使用while 循环还是什么?任何建议都会很棒。谢谢!
【问题讨论】:
标签: wordpress wordpress-theming custom-post-type