1

カテゴリの上に見出しを表示する必要があります。WordPressのカテゴリに投稿がある場合にのみ表示する必要があります。見出しはすべての投稿に配置しないでください。どうすれば解決できますか?

私が今得たコード:

<?php query_posts('category_name=onestar&showposts=5'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
         <div class="wrapper orangecolor">
             <article class="intro">
                 <h2><?php the_title(); ?></h2>
                 <div><?php the_content(); ?></div>
             </article>
         </div>
<?php endwhile; ?>
<?php endif; ?>
4

1 に答える 1

0
<?php query_posts('category_name=onestar&showposts=5'); ?>
<?php if ( have_posts() ) : ?>
    Put the header here
    <?php while ( have_posts() ) : the_post(); ?>
         <div class="wrapper orangecolor">
             <article class="intro">
                 <h2><?php the_title(); ?></h2>
                 <div><?php the_content(); ?></div>
             </article>
         </div>
    <?php endwhile; ?>
<?php endif; ?>
于 2012-12-30T13:10:13.117 に答える