我有一个 Wordpress 网站,我正在尝试从特定类别中获取帖子。那行得通,但现在我想用永久链接链接到特定的帖子。我无法让它在 foreach 中转义。有人可以告诉我/告诉我我在这里做错了什么吗?
<?php
global $post; // required
$args = array('category' => 9); // include category 9
$custom_posts = get_posts($args);
foreach($custom_posts as $post) :
setup_postdata($post);
echo "<a href='.the_permalink().'> the_title() </a> ";
the_excerpt();
//and so on..
endforeach;
?>