【wordpress】カスタム投稿タイプ仕組みについて | さけブロ。♡主にディズニー、htmlやcssなどのメモも♡

さけブロ。♡主にディズニー、htmlやcssなどのメモも♡

自分用htmlやcssなどメモ&身内向け料理日記&ただのディズニーマニア。海外ディズニーが最近好きすぎてヤバイ。WDW、DLR、HKDL、DLP、アウラニ、SHDL訪問済。クルーズも参加済。

カスタム投稿タイプはしばらく触らないと忘れる…ので簡単な構成を

 

カスタム投稿タイプで「notice」という投稿タイプを作り、記事を投稿する

 

「noticeの一覧が作りたい!!」

固定ページでnoticeの一覧ページを作る。

こんなんでリスト多分出る↓

                    <ul class="news-list">

                            <?php $paged = get_query_var('paged'); ?>
                            <?php query_posts( array( 'post_type' => 'notice',
                            'posts_per_page' => 3,
                            'paged' => $paged
                            )); ?>
                        <?php if(have_posts()): while(have_posts()): the_post(); ?>
                            <li>
                                <h3><?php the_title(); ?></h3>
                                <div>
                                <?php the_content(); ?>
                                </div>
                            </li>
                        <?php endwhile; endif; ?>

                    </ul>
                    <div class="center">
                    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
                    </div>

 

中の記事ページ整えたい!!

single-notice.php作ろう。

以上!!!!