テーマ twenty-eleven 複数カテゴリの最新記事 1件取得表示
-
掲題の通りの仕様にしたく質問致します。
おそらくcontent.phpではなく、index.phpで取得しループ表示させる事かと思いますが、エラーページが続き参っています。
■index.php
get_header(); ?> <?php get_sidebar(); ?> <div id="primary"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <?php twentyeleven_content_nav( 'nav-above' ); ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content_top', get_post_format() ); ?> <?php endwhile; ?> <?php twentyeleven_content_nav( 'nav-below' ); ?> <?php else : ?> <article id="post-0" class="post no-results not-found"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1> </header><!-- .entry-header --> <div class="entry-content"> <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p> <!--<?php get_search_form(); ?>--> </div><!-- .entry-content --> </article><!-- #post-0 --> <?php endif; ?> </div><!-- #content --> </div><!-- #primary --> <?php include( TEMPLATEPATH . '/right.php' ); ?> <?php get_footer(); ?>
■content.php(念のため)
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <?php if ( is_sticky() ) : ?> <?php $cats = get_the_category(); foreach( $cats as $cat) { echo $cat->cat_name; } ?> <hgroup> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <h3 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h3> </hgroup> <?php else : ?> <?php $cats = get_the_category(); foreach( $cats as $cat) { echo $cat->cat_name; } ?> <?php the_post_thumbnail( array(150,150) ); ?> <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1> <?php endif; ?> <?php the_time('Y年m月j日') ?> </header><!-- .entry-header --> <?php if ( is_search() ) : // Only display Excerpts for Search ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php else : ?> <div class="entry-contentTop"> <!--<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>--> <?php echo mb_substr($post->post_content,0,200).'...'; ?> <a href="<?php the_permalink(); ?>" >続きを読む</a> </div><!-- .entry-content --> <?php endif; ?>
何卒宜しくお願い致します。
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
- トピック「テーマ twenty-eleven 複数カテゴリの最新記事 1件取得表示」には新たに返信することはできません。