Best way to include reusable sections in page content

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:

Best way to include reusable sections in page content

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I 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.org/block-editor/

Best way to include reusable sections in page content

Best way to include reusable sections in page content


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x