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

时间:2021-08-08 19:19:51

I'm currently creating my own Wordpress page with a customized css layout. How do I make the "content" that is generated via the "Add Pages" appear in a certain part of my layout or div? Which codes do I use in PHP to make the paragraph (or html codes) I type in the "Add pages" appear in that particular div?

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

The image below would help support my explanation:

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

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

I hope someone could help. Thanks!

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

1 个解决方案

#1


1  

If you are writing the page in PHP on the backend, use this code to get a post. If you are using the page editor, there's a way to enable PHP in your post (it will compromise security though):

如果您在后端使用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;

#1


1  

If you are writing the page in PHP on the backend, use this code to get a post. If you are using the page editor, there's a way to enable PHP in your post (it will compromise security though):

如果您在后端使用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;