Wordpress 如何在主页中创建自定义帖子类型?
我的站点中有一个自定义主页。我想添加3个自定义的post ares来更新图像、文本和链接。如何在wordpress 3.1中实现这一点?在functions.php中创建自定义帖子类型。然后,为每个帖子类型向静态主页模板添加自定义循环,如下所示:Wordpress 如何在主页中创建自定义帖子类型?,wordpress,wordpress-theming,Wordpress,Wordpress Theming,我的站点中有一个自定义主页。我想添加3个自定义的post ares来更新图像、文本和链接。如何在wordpress 3.1中实现这一点?在functions.php中创建自定义帖子类型。然后,为每个帖子类型向静态主页模板添加自定义循环,如下所示: // The Query $args = array( 'post_type' => 'YOUR POST TYPE', 'posts_per_page' => 1 (Or as many or as fe
// 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();
?>