Show data from related post/term after selection

Support MB Relationships Show data from related post/term after selection

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16442
    brandonjpbrandonjp
    Participant

    I'm trying to create a display on an Admin Edit Post form that will show meta from a relational field after the related post/term is selected.

    Is there a built-in way to do this?

    If not, Any tips on creating this? (I'm guessing I'll use JS to make a custom request to get the data and populate a Custom HTML MB field)

    #16457
    Anh TranAnh Tran
    Keymaster

    Hi,

    Do you mean showing the data dynamically, based on the user selection of related posts/terms? If yes, then I think you'll have to do that your way with JS + custom HTML field.

    #16518
    brandonjpbrandonjp
    Participant

    I ended up accomplishing this using a Custom HTML field & a little PHP and JS.

    If anyone else ends up needing direction on this, here are a few links. This is not a drop-in solution for you but hopefully helps get you started.

    PHP to handle an incoming AJAX request for term metadata & return JSON:
    https://gist.github.com/21fed6266453de7ba76b3d2bc0e5a06f

    JS to fetch the taxonomy term metadata and place it into the page:
    https://gist.github.com/3b636d0c7e55ce6dc58ceba3de9a974e

    Add Custom HTML field with html to support the incoming term metadata (I also give it a custom class):

    After selecting a taxonomy it populates the Custom HTML like so:

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