wordpress add featured image below post title

假如想象 提交于 2021-02-10 18:29:28

问题


I try to display a featured image below the blog-post title. actually my posts look like:

WP-header
post-title
date | author | comments
post content
tag | category 

My goal is to get a full-sized-image (featured image) between post-title & date | author | comments Actually I am using a Corpo Theme.

Any ideas?
Best Regards


回答1:


You can fetch featured image using following code and paste it after post-title which should be <?php the_title() ?>

<?php 
 if ( has_post_thumbnail()) {
   $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
   echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" >';
   the_post_thumbnail('thumbnail');
   echo '</a>';
 }
 ?>

Since i haven't seen your full code so i can help you up-to this.

See Codex Tutorial



来源:https://stackoverflow.com/questions/21682150/wordpress-add-featured-image-below-post-title

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!