是的!自定义帖子类型是解决方案。答案就在这里完全概括:link text
基本上,我已将此添加到我的functions.php文件:
ADD_ACTION( '初始化', 'create_my_post_types');
function create_my_post_types() {
register_post_type('current_issue',
array(
'labels' => array(
'name' => __('Current Issues'),
'singular_name' => __('Current Issue')
),
'public' => true,
'exclude_from_search' => true,
'supports' => array('title', 'editor', 'thumbnail'),
)
);
}
,然后加入到我的homepage.php文件这样的:
<?php $loop = new WP_Query(array('post_type' => 'current_issue', 'posts_per_page' => 1)); ?>
<?php while ($loop->have_posts()) : $loop->the_post(); ?>
<?php the_post_thumbnail('current-issue'); ?>
<?php the_title('<h2><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
<div class="readmore" style="margin-top:4px">
<a href="#">Read More</a>
</div>
<?php the_content(); ?>
<?php endwhile; ?>
它完美!