404.phpで最新の投稿3件を表示できない。
-
404.phpのサイドバーに、最新の投稿3件を表示したいのですが、
page.phpでは動いたのですが、404.phpにしたとたん表示できなくなりました。原因が分かりません。
アドバイス頂けます様、宜しくお願い致します。
<?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div style="width:620px; margin:5px auto; border-bottom:dashed #CCCCCC 1px;"> <div id="single-title"> <h1><img src="<?php echo get_bloginfo('url') ?>/img/icn_arw_01.gif" hspace="5" align="baseline"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1> </div> <div id="single-contents"> <?php the_content(); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> </div> <?php endwhile; ?> <?php else : ?> <h2 style="font-size:14px;padding:2px;margin:0px;">404:ページが見つかりませんでした。</h2> <p style="font-size:14px;padding:2px;margin:0px;">5秒後に自動で、<a href="<?php get_bloginfo('url')?>">トップページ</a>へ移動します。</p> <?php endif; ?> </div> <div class="topnavi2"> <?php // ブログの最新記事 ------------- ?> <? if (have_posts()) :; ?> <div style="width:245px; padding:2px; border-bottom:#CCCCCC dashed 1px;"> <div class="projectB"> <p class="p-1">新着情報</p> <span class="ul-1"> <?php while (have_posts()) : the_post(); ?> <p style="font-size:12px;" class="title_blog"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <div style="width:220px;margin:5px auto;"><span style="font-size:10px;color:#666666;margin-bottom:1px;padding:2px;"><?php the_time('Y/m/d') ?></span> <span class="content_span"> <?php the_content_limit2(66); ?> </span> </div> <?php endwhile;?> </span> </div> </div> <?php endif; ?> <p style="text-align:right; padding:1px; margin:1px 5px; font-size:10px;"><a href="">記事の一覧</a></p>
6件の返信を表示中 - 1 - 6件目 (全6件中)
6件の返信を表示中 - 1 - 6件目 (全6件中)
- トピック「404.phpで最新の投稿3件を表示できない。」には新たに返信することはできません。