Fragments, snippets, shortcodes?


I am going to stop here because I don't want to give overload with information but I would like to let you know that you could very very easily turn this fragments into shortcodes which you could add in your editor such as [example_post_title] or [example_post_image].

@Thierry - you did overload my brain, but that gave me food for thought. In other topics it became clear that generally using UIkit markup for actual content is not the most optimal approach. In some other topics the subject of page builders & all that passed by. In another topic the subject of anchor links & connected navigation came up, as well as UIkit elements within what I tend to describe as "WP's main content area". In the mean time I found myself using a little snippets library plugin in WP to keep track of and use common content elements like a contact button, or an in-content cta.

Then reading back through your responses, something is nagging me in the back of my mind.

I'm not sure if I'm on the exact same proverbial page though, since the above was within a discussion on tweaking fragments themselves for theme development. Feel free to say if I'm not making any sense, but here it goes:

Here's the thing: you can do a hell of a lot with beans for the theme "as such", but it strikes me that it should also possible to use beans to create a library of reusable elements, which can be inserted by means of shortcode in TinyMCE when creating content.

So I'm picturing a "sort of" new helper php file to include via functions.php, or multiple ones (easier to pick & keep things slim when using page templates, as well as share with other developers), which contain ready-to-embed marked up sections (which can contain functionality, but they can also be content specific). Such an element can be pulled in with a shortcode.

Is this line of thinking making sense, or heading down a ditch? Or is this (third party) plugin territory?

Write a reply

Login or register to write a reply, it's free!