Does rwmb_outer_html still work?
- This topic has 7 replies, 2 voices, and was last updated 1 year, 2 months ago by
Peter.
-
AuthorPosts
-
February 11, 2024 at 1:00 AM #44535
maybeadev
ParticipantHi:
I can't seem to find rwmb_outer_html in the source even though its in the documentation ( https://docs.metabox.io/filters/rwmb-outer-html/ ).
Does it still exist? If not, what is the replacement filter/hook?
Thanks.
February 11, 2024 at 1:04 AM #44536maybeadev
ParticipantActually, I can't find any of the html filters mentioned on these documentation pages:
https://docs.metabox.io/filters/rwmb-outer-html/
https://docs.metabox.io/filters/rwmb-wrapper-html/
https://docs.metabox.io/filters/rwmb-begin-html/
https://docs.metabox.io/filters/rwmb-end-html/
https://docs.metabox.io/filters/rwmb-html/Thanks.
February 11, 2024 at 1:48 AM #44537maybeadev
ParticipantWeirdly the filters do seem to be called. I guess I'm not searching for the right things in the code.
So here's the question.
If I use the rwmb_outer_html filter to add a beginning div to the outer wrapper of a field, is there a way to prevent it from automatically adding the ending div until I add it manually to the end of another field?
Basically I'm trying to add a div wrapper to a group of fields. But no matter which filter I use, metabox seems to automatically try to clean up the html with matching closing tags which messes up what I'm trying to do.
Thanks.
February 15, 2024 at 7:55 PM #44566Peter
ModeratorHello,
The filter hook
rwmb_outer_html
is applied to the field and it generates a closing tag automatically. If you want to add a class to the field group (meta box), please use theclass
setting.
Following the documentation https://docs.metabox.io/creating-fields-with-code/February 15, 2024 at 11:13 PM #44578maybeadev
ParticipantHi:
Thanks. I actually want to add a class around a group of fields already inside the metabox. Adding the class on the metabox affects all fields. I want to add the class only around one or more groups of fields inside the metabox.
The only solution I was able to arrive at for this was to directly modify the metabox-columns plugin.
I modified it to accept two more values in the metabox array of fields "column_row_before" and "column_row_after" which allows for injection of the field class before and after any field 'row' without automatically closing up starting div.
I was hoping to be able to submit that as a PR against your repo but it's not a public repo.
There's probably a smarter way to do it - maybe by wrapping things the way the metabox group module works. But didn't want to spend that much time figuring that out.
Here's an image of the code changes for anyone interested.
Thanks.
February 16, 2024 at 10:09 PM #44585Peter
ModeratorHello,
Please try to use the option Before and After of the field settings to see if it helps. You can read more about that option in this topic https://support.metabox.io/topic/feature-request-simple-wrapper-element/?swcfpc=1
February 17, 2024 at 1:12 AM #44592maybeadev
ParticipantI think that still automatically closes a div that might be set in the BEFORE setting, right? I believe I tried that a bit ago. If you use a before such as '<div class="xxxx">' something causes the div to close up before we can specify a closing '</div>' of our own in a later field.
Unless that behavior has changed recently?
Thanks.
February 19, 2024 at 8:18 PM #44614Peter
ModeratorHello,
Yes, if you don't add a close div, it will add one automatically. However, you can add the close tag to another field, not the field where you add the open tag.
So you can wrap some fields in a div tag. -
AuthorPosts
- You must be logged in to reply to this topic.