How to show values of a parent child post type using custom fields

Support MB Relationships How to show values of a parent child post type using custom fields

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41597
    unknownwebguyunknownwebguy
    Participant

    Hi,

    We are new to Metabox and wordpress, we tried finding solution to our problem, however we were not able to find the solution:

    We are trying to build a school management site and we have created two custom post types:
    1. Class
    2. Section

    and have setup a relationship between these two (From Class To Section), which is working fine, like when we add a class then on the right hand side, it shows connects to section box and when we add a section then it shows a box on the right, connects from Class box.

    Now we have a created another custom post type Student and we have also created a group of custom fields where we've added a field of post type Class.

    Now we want when we select a class while adding a student then the available sections (which we selected while creating the class) should be displayed so that we can choose the section for the student being added.

    We've tried adding a field section which is of post type and tried various options in query qrgs (see screenshot) but nothing worked out, please help.
    Fields for Student Post Type: https://ibb.co/bjtTnS5
    Section Field Details: https://ibb.co/FBJHcbY

    What should we be doing here?

    #41600
    PeterPeter
    Moderator

    Hello,

    The argument post_parent__in accept an array of post IDs, it does not work with a string like parent. The MB builder also does not support passing a dynamic value, you need to add specific IDs or use the code to register the custom field to pass the dynamic value.

    Please read more on the following documentation
    https://docs.metabox.io/category/developer-guides/
    https://developer.wordpress.org/reference/classes/wp_query/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.