我正在使用wordpress MU 3.3.1。我想在循环中添加一个函数,该函数只显示带有图像或特色图像的帖子。
请帮助我如何过滤帖子。
<?php get_header(); ?>
<div id="content">
<?php
global $post;
$categories = get_categories(\'child_of=7694\');
foreach ($categories as $category) {
$cat_id = $category->cat_ID;
$games = get_posts(\'numberposts=6&orderby=rand&category=\'.$cat_id);
if ($games) : ?>
<div class="single">
<h1><a href="<?php echo get_category_link($cat_id); ?>"><?php echo $category->name; ?></a></h1>
<?php foreach ($games as $post) : $do_not_duplicate = $post->ID; ?>
<div class="game_title">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php echo get_post_meta($post->ID, \'mabp_description\', $single = true); ?>" >
<?php
if ( (strlen($post->post_title) > 10) ) {
echo substr($post->post_title, 0, 10)."..";
}
else {
the_title();
}
?>
</a>
<br />
<a href="<?php the_permalink() ?>" class="thumb_link" rel="bookmark" title="<?php echo get_post_meta($post->ID, \'mabp_description\', $single = true); ?>"><?php
gab_media(array(
\'name\' => \'gab_featured\',
\'enable_video\' => \'true\',
\'catch_image\' => \'true\',
\'enable_thumb\' => \'true\',
\'resize_type\' => \'c\',
\'media_width\' => \'60\',
\'media_height\' => \'34\',
\'thumb_align\' => \'featured_thumb\',
\'enable_default\' => get_option(\'of_nw_enfea2\'),
\'default_name\' => \'featured_thumb.jpg\'
));
?>
</a>
</div>
<?php endforeach; ?>
<div class="cat_link"><a href="<?php echo get_category_link($cat_id); ?>">More Games</a></div>
</div>
<?php endif; }?>
</div> <?php // End content div ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>