Support Forum
Hi:
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.
Actually, 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.
Weirdly 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.
Hello,
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 the class
setting.
Following the documentation https://docs.metabox.io/creating-fields-with-code/
Hi:
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.
Hello,
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
I 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.
Hello,
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.