显示自定义帖子类型标题的列表

时间:2012-10-17 17:35:45

标签: php javascript jquery ajax wordpress

我正在使用以下代码显示自定义帖子类型列表:

    <!-- List post types -->
    <?php $args = array(
        'post_type'=>'artworks_post',
        'title_li'=> __('')
    );
    wp_list_pages( $args ); 
    ?> 

问题是我无法控制该列表,是否有其他方法可以显示自定义帖子类型标题列表,我可以控制它如何进行标记?

1 个答案:

答案 0 :(得分:1)

使用常规的'WP_Query()

// The Query
$the_query = new WP_Query( 'post_type=artworks_post' );

// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
    echo '<a rel="' .the_permalink(). '" href="' .the_permalink(). ' ">'. the_title() .'</a>';
endwhile;

// Reset Post Data
wp_reset_postdata();
相关问题