我有以下代码
<div id="featured-posts" class="container_12">
<?php
global $post;
$myposts = get_posts('numberposts=3&category=12');
foreach($myposts as $post) :
?>
<?php global $post; ?>
<?php
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' );
?>
<?php
$colors = array("#000000", "#949c51", "#571c1e", "#f36533", "#782a80", "#f6a41d", "#ed1b24");
$randomColor = $colors[array_rand($colors)];
?>
<a href="LINK OF THE POST"><div class="grid_4 featured-home" style="background: url(<?php echo $src[0]; ?> ) !important;">
<div class="featured-details" style="border-color: <?php echo $randomColor; ?>;">
<h2 style="color: <?php echo $randomColor; ?>;"><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
</div>
<div class="featured-lower" style="border-color: <?php echo $randomColor; ?>;"></div>
</div></a>
<?php endforeach; ?>
</div>
这需要最近的 3 个帖子,在类别 12 中,并将它们显示在一个 div 中。我希望整个 div 链接到帖子。你会看到它在哪里说LINK OF THE POST。谁能帮我把网址弄到这里?
谢谢dvent