0
我在我的网站有一个自定义主页。我想添加3个自定义帖子来更新图片,文本和链接。如何在wordpress 3.1中完成?如何在主页中创建自定义帖子类型?
我在我的网站有一个自定义主页。我想添加3个自定义帖子来更新图片,文本和链接。如何在wordpress 3.1中完成?如何在主页中创建自定义帖子类型?
在functions.php中创建自定义的帖子类型。 How to make custom post type!然后为每个帖子类型添加自定义循环到您的静态主页模板,如下所示:
// The Query
$args = array(
'post_type' => 'YOUR POST TYPE',
'posts_per_page' => 1 (Or as many or as few as you want -1 shows all!)
);
$the_query = new WP_Query($args);
// The Loop
while ($the_query->have_posts()) : $the_query->the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
// Reset Post Data
wp_reset_postdata();
?>