激活Wordpress中的Post缩略图功能,但如果没有要显示的图像,则不显示任何内容
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了激活Wordpress中的Post缩略图功能,但如果没有要显示的图像,则不显示任何内容相关的知识,希望对你有一定的参考价值。
I looked everywhere trying to find some code that could show me how to display the post thumbnail if there is an image, but to display absolutely nothing if there isn't an image to display (most just either added an image or there was a broken image if there was nothing to display).
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="borderimg"> <?php $thumbnail_image = get_post_meta($post->ID, 'post-image', true);?> <img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $thumbnail_image; ?>&h=141&w=200&zc=1" alt="" /> </a> <?php endif; ?>
以上是关于激活Wordpress中的Post缩略图功能,但如果没有要显示的图像,则不显示任何内容的主要内容,如果未能解决你的问题,请参考以下文章