カスタム投稿で作成したカスタム分類を同一ページ内に読み込みたい
-
初心者です。カスタム投稿で今まで開催したイベントを投稿できるようにしていて、カスタム分類で年別に分けています。
カテゴリー=平成16年→スラッグ=h16のような感じです。
現在平成16年~平成23年分あります。これを固定ページの中でカテゴリーごとに呼び出したいのですが(タブで切替表示するので)、今後カスタム投稿の管理画面側でカテゴリーが追加されると自動で出力ページ先にも表示されるようにしたいです。
現在はタブの部分はカスタムメニューで追加・出力されるようにしたのですが内容の部分が年別に自動で出力されないのでどうしようかと思っています。
今現在のページ出力用のテンプレートはこのようにコードを書いてるのですが
<?php wp_nav_menu(array( 'container' => '', 'menu_class' => 'tab' )); ?> <hr /> <div id="content"> <dl class="area" id="h23"> <?php query_posts( array( 'frontiercat' => 'h23', 'showposts' => 100 ) ); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <dt><?php the_title(); ?></dt> <dd><?php the_content(); ?></dd> <?php endwhile; endif; ?> </dl> <dl class="area" id="h22"> <?php query_posts( array( 'frontiercat' => 'h22', 'showposts' => 100 ) ); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <dt><?php the_title(); ?></dt> <dd><?php the_content(); ?></dd> <?php endwhile; endif; ?> </dl> <dl class="area" id="h21"> <?php query_posts( array( 'frontiercat' => 'h21', 'showposts' => 100 ) ); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <dt><?php the_title(); ?></dt> <dd><?php the_content(); ?></dd> <?php endwhile; endif; ?> </dl> <dl class="area" id="h20"> <?php query_posts( array( 'frontiercat' => 'h20', 'showposts' => 100 ) ); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <dt><?php the_title(); ?></dt> <dd><?php the_content(); ?></dd> <?php endwhile; endif; ?> </dl> <dl class="area" id="h19"> <?php query_posts( array( 'frontiercat' => 'h19', 'showposts' => 100 ) ); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <dt><?php the_title(); ?></dt> <dd><?php the_content(); ?></dd> <?php endwhile; endif; ?> </dl> <dl class="area" id="h18"> <?php query_posts( array( 'frontiercat' => 'h18', 'showposts' => 100 ) ); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <dt><?php the_title(); ?></dt> <dd><?php the_content(); ?></dd> <?php endwhile; endif; ?> </dl></div>
この
<dl class="area" id="h23"> <?php query_posts( array( 'frontiercat' => 'h23', 'showposts' => 100 ) ); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <dt><?php the_title(); ?></dt> <dd><?php the_content(); ?></dd> <?php endwhile; endif; ?> </dl>
の部分をカテゴリーごとに取得してループで表示することは可能でしょうか?
ずっとデザインをメインで作ってきたので、PHPは勉強を始めたばかりです。
どうぞよろしくお願いいたします。
4件の返信を表示中 - 1 - 4件目 (全4件中)
4件の返信を表示中 - 1 - 4件目 (全4件中)
- トピック「カスタム投稿で作成したカスタム分類を同一ページ内に読み込みたい」には新たに返信することはできません。