最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

display div tag only if post has thumbnail

programmeradmin4浏览0评论

I would like to display post thumbnail and excerpt side by side but even if post hasn't got a thumbnail its div still there to be seen. How could I disappear thumbnail's parent div?

So far I've tried following but did not work.

<!-- post thumbnail -->
        <?php if( has_post_thumbnail()) : { ?>
        <div class="thumb-image">
            <?php the_post_thumbnail(); ?>
            </div>
        <?php } ?>
<?php endif; ?>
发布评论

评论列表(0)

  1. 暂无评论