[英]Adding link to post thumbnail
<div id="page" class="hfeed site">
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<?php the_post_thumbnail('full');
else: ?>
<div id="headimg"><img class="ImageResize560" src="<?php header_image(); ?>"></div>
I need to use this code, so that I can link the image, same time 我需要使用此代码,以便可以同时链接图像
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
Basically I need to link the post thumbnail to homepage... I tried but I get error.. somewhere wrong with "else: ?>" 基本上,我需要将帖子缩略图链接到主页...我尝试过,但是出现错误..“ else:?>”错误
Here is the code 这是代码
<div id="page" class="hfeed site">
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<?php $image_url = home_url( ); ?>
<a href="<?php echo $image_url; ?>">
<?php the_post_thumbnail('full'); ?>
</a>
<?php else : ?>
<div id="headimg"><img class="ImageResize560" src="<?php header_image(); ?>"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.