How to list custom fields on a page - including related fields
- This topic has 3 replies, 2 voices, and was last updated 5 years, 3 months ago by
Anh Tran.
-
AuthorPosts
-
January 6, 2020 at 3:59 PM #17731
Robert O. Aakerman
ParticipantHi,
This is a several part question - asking since I have a hard time finding the answers:
I have a Cat database with 3 different dB tables that relates to each other
- Cat (Name, number and metadata) (A Cat is unique but can be parent to other cats)
- Observation place (Where it was seen) (Same cat can be seen at different times and places)
- Origin town (Where it came from) (Different cats can be from same town)- How do you show your Custom fields in a table on a Page in frontend - Is there a MB plugin?
- How would you go about showing all the Custom Fields - INCLUDING the related Custom Fields data?
(That is show all CATs with all their Observations and where it Originated from) - Can you sort such a table on Field titles?
- How can you make a search for a Cat and show all Custom Fields and Related Custom Fields?
(This could be a separate page with a Search form that gives result under the form so you can serach over and over.
Really grateful for any hints, tips or tricks to achieve this.
Anything that will make me understand the necessary steps.The MB is really nice and good...but there are so many bits and pieces 🙂
//Aakerman
January 7, 2020 at 3:23 PM #17754Anh Tran
KeymasterHi Robert,
How do you show your Custom fields in a table on a Page in frontend – Is there a MB plugin?
You probably need to use some code to output the custom fields. Please refer to the helper functions to do that. As you control the code, you can output it the way you want (in table or list, or plain HTML).
How would you go about showing all the Custom Fields – INCLUDING the related Custom Fields data?
If you use MB Relationships to create relationships between objects, you can get all the related items. And for each item, you can get custom fields using the helper functions as above.
Can you sort such a table on Field titles?
You might want to use a JS-solution such as DataTables.
How can you make a search for a Cat and show all Custom Fields and Related Custom Fields?
Please try FacetWP. We also have a free integrator with it.
January 7, 2020 at 8:43 PM #17760Robert O. Aakerman
ParticipantThank you for the good answers.
Regarding FacetWP; am I to understand that the MB Custom fields are NOT searchable at all, unless we get FacetWP?
//Aakerman
January 9, 2020 at 4:53 PM #17785Anh Tran
KeymasterHi Robert,
am I to understand that the MB Custom fields are NOT searchable at all, unless we get FacetWP?
Yes and no.
For simple fields (non-clonable and non-groups), they're searchable using meta query of WP_Query.
For clonable fields and groups (and also fields in the custom table), the data is stored in the serialized format, which makes the meta query useless. FacetWP resolves this problem quite well.
-
AuthorPosts
- You must be logged in to reply to this topic.