繁体   English   中英

如何使用Wordpress使段落显示在页面的特定区域中?

[英]How to make a paragraph appear in a certain area in the page using Wordpress?

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

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

某个div内的generate-paragraph

我希望有人可以帮忙。 谢谢!

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

暂无
暂无

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

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