admin管理员组文章数量:1302405
I'm fairly new to WP dev and I'm trying to work out the best method to include reusable sections/templates within the page content added within the page editor. I have included an image to illustrate what I mean:
The content highlighted in green is added to the page via the editor. What I want to know is, how do I split up those sections with reusable sections/includes. Obviously, I can just added the markup into the page content but I assume there is a much better way of doing it?
I have been reading about shortcodes, is that the best way to approach this? If correct, I guess the best way would be to create template partials (or whatever the correct term is) for each reusable section, then create shortcode functions for them in the functions.php. Then add them to the page content using shortcodes?
Hope this makes sense.
Thanks
I'm fairly new to WP dev and I'm trying to work out the best method to include reusable sections/templates within the page content added within the page editor. I have included an image to illustrate what I mean:
The content highlighted in green is added to the page via the editor. What I want to know is, how do I split up those sections with reusable sections/includes. Obviously, I can just added the markup into the page content but I assume there is a much better way of doing it?
I have been reading about shortcodes, is that the best way to approach this? If correct, I guess the best way would be to create template partials (or whatever the correct term is) for each reusable section, then create shortcode functions for them in the functions.php. Then add them to the page content using shortcodes?
Hope this makes sense.
Thanks
Share Improve this question asked Mar 10, 2021 at 9:59 BurnsBurns 32 bronze badges 2- I would create a gutenberg bloc, which then you can use as a reusable bloc, what excatly do you want to have inside those blocs ? – lucrece Commented Mar 10, 2021 at 10:19
- Hi, thanks. They are just blocks of content (html, images) like CTAs, feature lists, faqs etc) that might be included in other pages. Did you mean Gutenberg block? – Burns Commented Mar 10, 2021 at 10:26
1 Answer
Reset to default 1I think you should to take a look at the gutenberg bloc.
This is not simple at the first approach, but I think you should take a look at it (even if you want to use some plugin to help you)
See the doc : https://developer.wordpress/block-editor/
本文标签: shortcodeBest way to include reusable sections in page content
版权声明:本文标题:shortcode - Best way to include reusable sections in page content 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741690626a2392701.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论