如何使用Wordpress使页面出现在页面的某个区域?

时间:2012-08-12 19:07:55

标签: php html css wordpress layout

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

下面的图片有助于我的解释:

generate-paragraph inside a certain div

我希望有人可以提供帮助。谢谢!

1 个答案:

答案 0 :(得分: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;