wordpress 在帖子标题下方添加特色图片 [英] wordpress add featured image below post title

查看:43
本文介绍了wordpress 在帖子标题下方添加特色图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在博客文章标题下方显示特色图片.实际上我的帖子看起来像:

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 

我的目标是在 post-title 和<代码>日期 |作者 |评论实际上,我使用的是 Corpo 主题.

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

推荐答案

您可以使用以下代码获取特色图片并将其粘贴到 post-title 之后,应该是

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.

请参阅Codex 教程

这篇关于wordpress 在帖子标题下方添加特色图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆