2010-10-14 71 views

回答

0

在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(); 

    ?> 
相关问题