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>
我想換行格「優惠券 - 後」與鏈接。
這就像一個魅力!謝謝!!! –