Create reusable parts
- This topic has 7 replies, 2 voices, and was last updated 2 years, 4 months ago by
seaj1one.
-
AuthorPosts
-
December 10, 2022 at 8:16 PM #39665
seaj1one
ParticipantI was wondering if this is possible using Meta box IA or, if possible, the best approach.
When I create different website sections on the page i.e. feature cards, benefits cards, or even the hero section. I may only use field types text and textarea. The text for the heading and the textarea for the description/ supporting heading text or whatever you may call it.
I would have to create a separate group for each use case. I'm wondering if you could create a group, say, called heading_plus_text, once and reuse it but be able to change the label if made cloneable.
I've created initially a group called page section. Within the page section, I've created a group called section, and I'd love it if I could clone heading_plus_text but be able to change the label. So as I add a new heading_plus_text, I can change that label.
December 10, 2022 at 8:34 PM #39667seaj1one
ParticipantAnother option I can think of is that I can create all of the groups within the section group and create all of the subgroups, as mentioned above as my examples. Feature cards, benefits cards, and hero section, but use the select field to choose which groups are visible under the section group on each page.
Can all this be done without code but using the Metabox UI?
December 11, 2022 at 11:03 PM #39690Peter
ModeratorHello,
1. It is not possible to create reusable custom fields like that. Each field has its own settings and field ID to save the value to the database. It does not work like a section of a builder.
2. You can use the extension MB Include Exclude to load a field on a specific page. Read more on the documentation https://docs.metabox.io/extensions/meta-box-include-exclude/
December 12, 2022 at 1:09 AM #39693seaj1one
ParticipantHello Peter
Is there a Gui for MB Include Exclude by any chance?
If I were to create all the templates but use conditional logic to show or not show on certain pages, would this put a strain on my server? Just trying to understand if what I'm trying to do is bad practice.
December 12, 2022 at 11:12 PM #39725Peter
ModeratorHello,
The extension MB Include Exclude is supported to use in the builder, please check this screenshot https://monosnap.com/file/fLa5t2xG6LKtkhUrNrivDlOsp2J7VJ
You can click the text link "Advanced location rules" to read the documentation of the extension supported.
MB Conditional Logic uses the JavaScript code to show/hide a custom field or a field group or any elements on the editing page. It is a little more flexible than MB Include Exclude but it will load all field groups to when editing a page and show/hide elements based on a field value. I don't think it will slow down your site in the admin area or affect the server with some field groups.
December 12, 2022 at 11:52 PM #39727seaj1one
ParticipantHello Peter
Thanks for the reply.
I see that there's an issue with the Advanced location rules, which appears that he may have been fixed via your GitHub.
I can wait for the fix to be realised via the plugin and try it out for sure.
Kind regards
Stephen
December 14, 2022 at 8:59 PM #39781Peter
ModeratorHello,
The issue with Advanced Location has been fixed in the new version of Meta Box 5.6.14. Please update the plugin to make it works.
December 17, 2022 at 8:29 PM #39893seaj1one
ParticipantHello Peter
It works fine, thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.