In the WPDevDesign Facebook group, a user asked:
Is there a way to get the Meta box sampling fields programmatically in the repeater? (for example, I want to use one of the group fields as a repeater div class).
This members-only tutorial provides the steps to create a custom function with group ID and sub-field ID parameters and call this function with our group ID and sub-field ID as the arguments via Hydrogen Pack's Dynamic Classes feature when using Meta Box in Oxygen.
We shall register a
css_class custom field inside a Group-type of field and when this is populated for the posts a Repeater component showing the posts will automatically add the class that has been set for each post for its Div.
Install and activate Meta Box and Meta Box AIO plugins.
Go to Meta Box > Custom Fields and create a new group named say, "Post Fields".
Add a "Group" type of field and inside that, a "Text" type of field having a label of "CSS Class" so that the field ID automatically becomes "css_class".
Edit your posts and for each, set your desired class for this post in Oxygen Repeater.
Install and activate Code Snippets plugin.
Go to Snippets > Add New.
Title: [Function] Get MB Group Sub-Field Value
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.