此循环显示主题选项中指定的特定类别中超过4个帖子标题的一篇特色帖子。
我想做的是显示4个标题中的所有4个帖子,在4个标题之上。
这4个标题来自这段代码
<a class="listtitle" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( \'Permalink to %s\', \'wpnewspaper\' ), the_title_attribute( \'echo=0\' ) ); ?>" ><?php the_title(); ?></a>
这里是完整的循环代码。
<div class="col">
<?php gab_dynamic_sidebar(\'Subnews1\');?>
<?php
$postnr = of_get_option(\'of_wn_nr8\') + of_get_option(\'of_wn_nr8a\');
if (intval($postnr) > 0 ) { ?>
<span class="catname"><a href="<?php echo get_category_link(of_get_option(\'of_wn_cat8\'));?>"><?php echo get_cat_name(of_get_option(\'of_wn_cat8\')); ?></a></span>
<?php
$count = 1;
$args = array(
\'post__not_in\'=>$do_not_duplicate,
\'posts_per_page\' => $postnr,
\'cat\' => of_get_option(\'of_wn_cat8\', 1)
);
$gab_query = new WP_Query();$gab_query->query($args);
while ($gab_query->have_posts()) : $gab_query->the_post(); if (of_get_option(\'of_dnd\') == 1) { $do_not_duplicate[] = $post->ID; }
?>
<div class="featuredpost<?php if($count == of_get_option(\'of_wn_nr8\') or $count == $postnr) { echo \' lastpost\'; } ?>">
<?php if ($count <= of_get_option(\'of_wn_nr8\')) { ?>
<h2 class="posttitle">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( \'Permalink to %s\', \'wpnewspaper\' ), the_title_attribute( \'echo=0\' ) ); ?>" ><?php the_title(); ?></a>
</h2>
<div class="opinion_wrapper">
<?php
gab_media(array( \'imgtag\' => 1, \'link\' => 1,
\'name\' => \'wn-subnews\',
\'enable_video\' => 0,
\'catch_image\' => of_get_option(\'of_catch_img\', 0),
\'enable_thumb\' => 1,
\'resize_type\' => \'c\',
\'media_width\' => 120,
\'media_height\' => 103,
\'thumb_align\' => \'alignleft\',
\'enable_default\' => 0
));
?>
<div class="opinion_marker"><!-- opinion marker --></div>
</div>
<p><?php echo string_limit_words(get_the_excerpt(),27); ?>…</p>
<?php gab_postmeta(); ?>
<?php } else { ?>
<a class="listtitle" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( \'Permalink to %s\', \'wpnewspaper\' ), the_title_attribute( \'echo=0\' ) ); ?>" ><?php the_title(); ?></a>
<?php } ?>
</div><!-- .featuredpost -->
<?php $count++; endwhile; wp_reset_query(); ?>
<?php } ?>