0
我有9个帖子出现在一个页面上。我只显示帖子中的精选图片,图片设置为背景图片。我希望能够点击图像并将图像显示在新窗口中。我在解决这个问题时遇到了一些麻烦。我想在链接中包装div。WordPresspress精选图片链接
这是我的代码:
<article <?php post_class('col-md-4 site-content'); ?>>
<?php if (has_post_thumbnail($post->ID)): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id(
$post->ID), 'large');
$image = $image[0]; ?>
<?php endif; ?>
<div class="coupons-post" style="background-image: url('<?php echo
$image; ?>')">
<?php /*?><div class="entry-thumbnail">
<a href="<?php the_permalink(); ?>"><?php
the_post_thumbnail('large' , array('class' => 'img-responsive')); ?></a>
</div><?php */?>
<!-- <div class="post-content">
<div class="entry-meta">
<p class="date">News/<?php the_time('n.j.Y') ?></p>
</div>
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
<div class="entry-summary">
<p></p><p><?php $excerpt = get_the_excerpt(); ?>
<?php echo substr($excerpt, 0, 100); ?>...</p>
<p></p>
<a class="read-more" href="<?php the_permalink(); ?>">Read More</a>
</div>
</div>-->
</div>
</article>
我想换行格“优惠券 - 后”与链接。
这就像一个魅力!谢谢!!! –