开发者

wordpress custom tag get_post_meta(),how to retrieve several posts at a time?

I am trying to customize a wordpress plugin,where custom tag "get_post_meta()" is used. The code is as follows:

<?php query_posts('showposts=5'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2>" title="<?php the_title(); ?>">
<?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<?php $gallery = get_post_meta($post->ID, 'Thumbnail', $single = true); ?>
<img src="<?php echo $gallery; ?>">`

I tried with making the parameter false and to retrieve array values,but it returns just one value. But its not happening.Also tried with foreach loop after the_post(). can any one suggest me to have several posts at a time.Actually I want dif开发者_开发知识库ferent image url that means several $gallery.

Thanks in advance.


Try this:

<?php while ( get_post_meta( $post->ID, 'Thumbnail', true ) != '' : ?>
<img src="<?php get_post_meta( $post->ID, 'Thumbnail', true ); ?>" />
<?php endwhile; ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜