简体   繁体   English

Wordpress按ID显示帖子

[英]Wordpress show posts by ID

I'm a litle stuck here, I want to get one or more posts just by their ID. 我被困在这里,只是想通过他们的ID获得一个或多个帖子。 What I've got now is: 我现在得到的是:

<?php
$post_id = 1;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
echo $content;
?>

Though this shows my post without the breaks and looks I made in my backend. 虽然这显示了我的帖子没有中断,但看起来是我在后端制作的。 And I think this is kinda a long code for getting a single post. 我认为这对于获取单个帖子来说有点长。

So my question is, how can I get an post by ID to be shown in the most clean code with the breaks I put in the backend. 所以我的问题是,我如何通过ID获得帖子,以便在最干净的代码中显示,并在后端添加中断。

这就是get_post的重点,我不相信还有另一种方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM