Custom Fields
Re-Envisioned
Support MB Relationships Practical use of MB Relationships to Link Posts

  • Creator
    Topic
  • #32252
    admin@5web.co.uk
    Participant

    I might have missed something, but I can't figure out how to use the relationships created by MB Relationships.

    I see how easy it is to set up a relationship between two post types (to create a parent - child effect), and have the select box in the post admin.

    But it seems that is where Meta Box ends in terms of what you can do via the GUI.

    I am use MB Frontend Submission so users can submit a post via frontend, and what that post linked to another (so it saves with that link and displays based on it).

    When creating the field that is used for the frontend submission, there is no way to select the relationship, from what I can see.

    What I need to do is, when viewing one post via frontend, a user can submit another post, that is then linked to the displayed post. So when that use opens that post again, they see their connected post.

    So I presume what I want to do is only possible via code. I really wanted to keep this GUI based. But I guess in this case I need to copy the PHP code from the Builder, then not use the GUI and add code manually that will get and save that related post.

    Is there a Meta Box way of doing this in PHP?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #32263
    Long Nguyen
    Moderator

    Hi,

    If you want to show the relationship box on the frontend submission form, please refer to this topic https://metabox.io/support/topic/connecting-related-custom-post-types-with-frontend-form/

    If you want to set the relationship automatically between the current post which shows the frontend form and the post will be created, please refer to this topic https://metabox.io/support/topic/prepopulate-relationship-field-with-current-post-id/

    #32269
    admin@5web.co.uk
    Participant

    Hi,

    Thanks.

    YEs, I want to the second, but also to also display the created post when that user revisits that main post again (so a post within a post).

    Is that support thread the only information on this? It's very long and confusing. Perhaps Meta Box is not the right solution for this.

    I'm trying to avoid a lot of custom coding here, so maybe Meta Box is not the right solution here. IS there anything Meta Box connects with that would deal more fully with the relationship side?

    #32277
    Long Nguyen
    Moderator

    Hi,

    If you want to show the related posts with the current post, please follow this documentation https://docs.metabox.io/extensions/mb-relationships/#getting-connected-items

    Just to clarify that Meta Box helps you to set up many things "behind the scene" and show the value on the front end. But Meta Box does not support building the template of post/page so you need to write some code to show the related posts.

    #32284
    admin@5web.co.uk
    Participant

    Hi,

    Thanks for your help here. I am actually trying to help Meta Box here. A long time ago I told the creator that I though Meta Box would need to choose which side it was on (GUI or developer-only tool).

    Right now it's for experienced WordPress devs only, unless users only want to do simple things.

    Take for example this: https://docs.metabox.io/extensions/mb-relationships/#getting-connected-items. From section Getting Connected Items and onwards, it's an advanced developer manual. There is no information about where that code should go.

    I'm back to where I was the last time I tried using Meta Box. It's either ACF for the more in-depth GUI or nothing as I may as well code it manually (with WordPress functions, it's not much longer and doesn't need the plugin).


    Sorry if that sounds harsh. I think the Meta Box team should try an experiment. Find 2 experienced WordPress devs who don't know Meta Box. Ask them to create a relationship between posts, and display those connected posts within a 'parent' post. Give one Meta Box and one without. Which one will be finished first?

    Then take the same scenario with non-developer website builders. In that case, what will they do? They won't have knowledge to do it manually and won't understand the Meta Box docs, so likely they turn to ACF.

    I think these are questions the Meta Box team should be thinking about.

    #32315
    Long Nguyen
    Moderator

    Thanks for your feedback.

    Have you tried to use MB Views to show the field value and relationships on the frontend? It might be easier to understand how it works. But a little knowledge of code would be better to control what will show up.
    https://docs.metabox.io/extensions/mb-views/

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