Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterFYI, it's now updated. Please check and let me know how it goes.
March 9, 2018 at 10:59 AM in reply to: ✅i cant change metaboxes status to draft They are always on publish state. #8751Anh Tran
KeymasterThe status for meta box is now supported. Please update.
Anh Tran
KeymasterNo problem.
Here is the process of creating the storage for meta box and its fields:
- When a meta box is created, a storage will be created for it. The function
rwmb_get_storage()will handle the creation.
- Therwmb_get_storage()uses a filterrwmb_get_storagethat allow extensions to change the storage. That's where the MB Custom Table filters and change the storage to work with post meta to the one works with the custom table. In this filter, the whole meta box settings is passed, so extensions know thestorage_typeand table name.
- After the creation, this storage will be added to all fields in the meta box via$field['storage']parameter.
- When working with the meta value (get/save), this storage will be use like$field['storage']->get()and$field['storage']->update().So, storage is kind of the abstract layer between the code and the database. And that can be changed with filters.
That's how the plugins work. If there's something unclear, please let me know.
Anh Tran
KeymasterYes, that's right.
Anh Tran
KeymasterThanks for bug report. It's just fixed on Github.
Anh Tran
KeymasterHello Christoph,
I've just tried to debug that, here is my similar code: https://imgur.elightup.com/gh4PTcA.png
And here is how it appears in the frontend: https://imgur.elightup.com/sYO8S4U.pngCan you take a screenshot of your full code?
Anh Tran
KeymasterHi James,
Great stuffs!
What would I have to do to customize the FacetWP Integrator so that it would loop through the custom fields that I want to use as facets or indices? Is there not a way to have the Integrator do this by using the parameters ‘storage_type’ & ‘my_table_name’?
I forgot about this! The Integrator uses Meta Box's function
rwmb_get_value()to get field value and that already handles the storage type. Theoretically, it should work! Can you please just try it and let me know how it goes?Anh Tran
KeymasterHi Dave,
It was probably a bug in the extension when updating the version. I couldn't replicated it in my localhost. So I think it's all fine now. BTW, we're updating the extension soon.
Anh Tran
KeymasterHello James,
Thanks for asking the great question! You're indeed right about 90%.
Meta Box uses WordPress standard way to store post meta. So it should work in most cases as normal custom fields for FacetWP.
However, there are 2 cases that we need to handle: clone and multiple fields, as you can see in this code: https://imgur.elightup.com/ONbJioO.png
The reason is clone values is saved as serialized array in the post meta, thus, it's not the standard WP way. Actually, WP doesn't have mechanism to save such kind of data yet. So, we have to find a way to work on that. Because FacetWP doesn't process serialized array, we have to do that.
The other case of field with multiple values, although it's the WP's way, but I still pull all the data just for sure.
So, if all of your fields (or the fields you want to filter) is just normal / uncloneable fields, you can just use FacetWP without any problem. In other cases, the extension will help.
Anh Tran
KeymasterHi James,
Unfortunately, no. The FacetWP plugin doesn't handle data stored in a custom table 🙁
Anh Tran
KeymasterHi Dave,
Just fixed the bug. Somehow the meta box status (post status) is saved as an empty string, so they don't show up.
I fixed by doing a trick: first query all meta boxes with
post_type=anyto get all the ID. Then go to URL domain.com/wp-admin/post.php?post=ID&action=edit and change the post ID to be able to edit the meta box. Finally, go to tab Settings and set the status to Published.Now all meta boxes are visible.
Anh Tran
KeymasterHi Dave,
It's hard to know what the problem is. Please send me an admin account to [email protected].
Anh Tran
KeymasterHmm, that's quite strange. If it shows All (3), then that means the meta boxes are there. Can you make a screenshot?
Anh Tran
KeymasterHi Jackky,
You can write a custom storage for this purpose. Take a look at this:
https://github.com/wpmetabox/meta-box/tree/master/inc/storages
Then you can filter to
rwmb_get_storageto use your custom storage:https://github.com/wpmetabox/meta-box/blob/master/inc/functions.php#L227
March 7, 2018 at 3:09 PM in reply to: extension is not working ( gives some errors with metabox builder ) #8717Anh Tran
KeymasterAbsolutely!
-
AuthorPosts