Php 显示某些wordpress帖子

Php 显示某些wordpress帖子,php,wordpress,Php,Wordpress,我已经在我的主页上显示了特定帖子的内容,但是我想把这些内容包装在一个锚定标签中,这样当点击时它就会链接到完整的帖子页面。我的代码是: <div class="key_product"> <?php $post_id = 105; $queried_post = get_post($post_id); $title = $queried_post->post_title; echo get_the_post_thumbnail($po

我已经在我的主页上显示了特定帖子的内容,但是我想把这些内容包装在一个锚定标签中,这样当点击时它就会链接到完整的帖子页面。我的代码是:

<div class="key_product">
                    <?php
$post_id = 105;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
echo get_the_post_thumbnail($post_id);
?>
</div>


我很难让它工作。我如何才能做到这一点?

您可以像使用get\u post一样使用get\u permalink:

$post\u id=105;
$queryed\u post=get\u post($post\u id);
$title=$queryed\u post->post\u title;
$permalink=get\u permalink($post\u id);
回声';
但是,permalink可能位于$queryed\u post对象中。您可以
打印($queryed\u post)
来检查它

$post_id = 105;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
$permalink = get_permalink($post_id);
echo '<a href="' . $permalink . '">' . get_the_post_thumbnail($post_id) . '</a>';