0

我目前正在使用自定义的 CSS 布局创建自己的 Wordpress 页面。如何使通过“添加页面”生成的“内容”出现在我的布局或 div 的某个部分?我在 PHP 中使用哪些代码来使我在“添加页面”中键入的段落(或 html 代码)出现在该特定 div 中?

下图将有助于支持我的解释:

在某个 div 中生成段落

我希望有人能帮忙。谢谢!

4

1 回答 1

1

如果您在后端用 PHP 编写页面,请使用此代码获取帖子。如果您使用的是页面编辑器,有一种方法可以在您的帖子中启用 PHP(虽然它会损害安全性):

$my_postid = 12;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
于 2012-08-12T19:17:23.427 回答