Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterOh, I see. The problem is you missed the
fieldsparameter forgroupfield. You have to do like this:'fields' => array( array( 'id' => 'group', 'type' => 'group', 'fields' => array( // you missed this parameter for group array(...), array(...), ), ), ),Anh Tran
KeymasterCool, glad it helps ๐
I'd think about order to records fields. Thanks for your idea!
Anh Tran
KeymasterAre you using
get_post_customto get post meta? Because from what you said, it looks like you display fields in the backend in one order and display fields in the frontend in another order, and as we don't have a function to list all fields in the frontend, the only way to do that I guess isget_post_customfunction.If so, I'm afraid there's no way to achieve that. The order you register fields = the order fields are displayed in the backend = the order WP processes data and stores in the DB = the order you get with
get_post_custom.Or maybe you should do something like
array_reverseas a trick before displaying fields in the frontend?Anh Tran
KeymasterHi,
I see that the problem is you use the old way to integrate theme with Meta Box plugin. It's not recommended anymore as it broke as you saw.
To eliminate this problem, please
- Remove the first block of code to include Meta Box
- Install Meta Box from wp.org as a normal plugin
- Install MB Group extension
- Register meta boxes according to this documentation (I don't see your full code so I'm not sure you're usingrwmb_meta_boxesfilter, if yes - then it's perfect, you don't need to change anything, but if no, please update the code).I wrote another documentation explaining why we should use plugin instead of included it directly in themes. Please take a look.
Best regards
Anh Tran
KeymasterAll you need to do is moving the array of the latest field to the first place in the
fieldsarray, something like in this screenshot:
Anh Tran
KeymasterHi, as we're using code to register meta boxes and fields, the only way with coding to change fields' order is changing code. There's no easier way to do that :(.
Best regards.
Anh Tran
KeymasterThe example is well-written in the extension documentation. All you need is just add
includeorexcludeparameter to meta box definition, no need to add custom function for checking like better-include demo.Anh Tran
KeymasterUnfortunately the
better-include.phpmethod uses old way to register meta boxes (viaadmin_inithook). This way still works, but you can not use it withrwmb_meta_boxesfilter, e.g. if you register meta boxes withrwmb_meta_boxesfilter, you can't usebetter-include.phpmethod.I'd suggest you use only global
$meta_boxesvariable to register meta boxes, and remove code to register meta boxes viarwmb_meta_boxesfilter.A better solution is using MB Include Exclude extension, which is tested with Group extension.
Anh Tran
KeymasterNo problem, it's quite straight forward. Try this code:
Anh Tran
KeymasterGlad to hear that the data migration works well. It'd be a pain if we loose data.
I tried again with your code and I see that the last field doesn't have enough columns (8 while it should be 12 to fill in the row). It's a note that each row must have enough 12 columns, here you have first row with 2+10 columns, 2nd row with 4+4+4 columns and 3rd row has only 8 columns.
I tried changing 8 to 12 and it works fine to me:

Anh Tran
KeymasterHi eisenrith,
The MB Builder plugin helps you to create meta boxes and custom fields for posts in the back-end faster than traditional way (traditional way is registering via PHP code as described in this docs and this docs).
This extension doesn't mean to show meta values in the frontend. To do that, you need to use a helper PHP function
rwmb_meta()to retrieve meta value and display it. Please follow this detailed instruction and if you need any help, please let me know.Thanks
Anh Tran
KeymasterHi,
I've tested with your data and here is my result:
1. I use the following code to add data to a post:
https://gist.github.com/rilwis/452dec0295484a455875#file-add-data-php
2. Then I register a meta box with following code:
https://gist.github.com/rilwis/452dec0295484a455875#file-register-meta-boxes-php
And here is final result:
I think it works for me. Can you check the code to import data and register meta box again? If you need any help, please let me know.
Anh Tran
KeymasterSo it's solved now?
If you need me for anything, please let me know.
Anh Tran
KeymasterHi Andy,
I've just checked your code and it works for me: http://prntscr.com/6cft18
Can you please check again?
Anh Tran
KeymasterI think there is a misunderstanding here:
- The Group extension is just one kind of field (special one), it acts exactly like other field type like
text,file, etc.
- The techniques to show/hide meta boxes are applied for meta boxes only, not for fields, so they're not applied to groups.But you can do a tricky way like this to achieve what you want:
- Create a meta box
- In that meta box, define only 1 group and put all fields under this group
- Use techniques above to hide whole meta boxBecause this meta box contains only 1 group, show/hide this meta box actually show/hide this group.
Hope that helps. If you need anything, please let me know.
Thanks
-
AuthorPosts