admin管理员组文章数量:1429082
I am building a Wordpress/Woocommerce site, and developing a plugin for it.
In the plugin I am including some PHP html templates and hooking them into Wordpress in various ways.
Is there a way to visually compose and store these page snippets/sections somehow so that they can be viewed and edited in admin, through a visual composer?
I am envisioning something like Wordpress' page designer/editor, except just for page sections/snippets.
Thanks in advance!
I am building a Wordpress/Woocommerce site, and developing a plugin for it.
In the plugin I am including some PHP html templates and hooking them into Wordpress in various ways.
Is there a way to visually compose and store these page snippets/sections somehow so that they can be viewed and edited in admin, through a visual composer?
I am envisioning something like Wordpress' page designer/editor, except just for page sections/snippets.
Thanks in advance!
Share Improve this question edited May 5, 2019 at 13:30 Kerry Randolph asked May 4, 2019 at 17:20 Kerry RandolphKerry Randolph 993 bronze badges1 Answer
Reset to default 0I found that this can be done simply by using Wordpress' Page editor. Nothing else is needed:
- Compose the content in Wordpress' Page editor
- Save (but don't publish)
- In your code, retrieve the saved content
By ID:
$id=47; $post = get_post($id); $content = apply_filters('the_content', $post->post_content); echo $content;
Or by page title:
$title = 'page title'; $page = get_page_by_title( $title ); $content = apply_filters('the_content', $page->post_content); echo $content;
Note that apply_filters is used in case there is a plugin somewhere that wants to "apply filters" to the_content - it's good for forwards compatibility.
本文标签: pluginsIs there a visual editor specifically for page snippetssections
版权声明:本文标题:plugins - Is there a visual editor specifically for page snippetssections? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745522738a2661700.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论