サポート » 使い方全般 » カスタム投稿タイプ+カスタムフィールドの日付で年別アーカイブリスト

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック投稿者 blackbard

    (@blackbard)

    念のため、追記しておきます。
    イベントのトップと年別アーカイブ用のテンプレートは下記のようにしております。

    date-events.php

    <?php
    	if (have_posts()) :
    	while (have_posts()) : the_post();
    		if(is_year()):
    ?>
    
     <!-- ここに処理 -->
    
    <?php
    		endif;
    	endwhile;
    	endif;
    ?>

    page-events.php

    <?php
     $post = get_posts( array(
           'post_type' => 'events', //特定のカスタム投稿タイプスラッグを指定
    		'orderby'=> 'meta_value',
    		'meta_key'=>'eventdate',
    		'order'=> 'DESC',
    		'showposts'=>'50',
    		'meta_type' => 'DATE',
      ));
     foreach( $post as $post ):
     setup_postdata( $post );
    ?>
    
     <!-- ここに処理 -->
    
    <?php
      endforeach;
      wp_reset_postdata();
    ?>
1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック「カスタム投稿タイプ+カスタムフィールドの日付で年別アーカイブリスト」には新たに返信することはできません。