1

このコードを使用して、カスタム投稿タイプのリストを表示しています:

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

問題は、そのリストを制御できないことです。マークアップの作成方法を制御できるカスタム投稿タイプのタイトルのリストを表示する他の方法はありますか?

4

1 に答える 1

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();
于 2012-10-17T17:56:43.493 に答える