我想格式化具有自定义类型的单个帖子页面模板。我使用完全显示帖子内容的the_content(),但是如何调用个别内容字段以便我可以将它们排列在模板中?如何在Wordpress帖子页面安排the_content()?
的functions.php
function stories_init() {
$args = array(
'label' => 'Stories',
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'stories'),
'query_var' => true,
'menu_icon' => 'dashicons-video-alt',
'supports' => array(
'title',
'editor',
'custom-fields',
'thumbnail',)
);
register_post_type('stories', $args);
}
单post.html
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
你想与我沟通什么*我如何调用个别内容字段,以便我可以将它们安排在模板中?*顺便说一句,你可以创建一个名为:的文件。 “** single-stories.php **”并在该文件中执行所有自定义... – Poiz
我想访问不同div的内容。例如,我希望标题出现在与编辑器中的文本不同的列中。所以我试图只返回自定义字段。 – emcee