Displaying related posts in Posts Table Pro (and other solutions)

Support MB Relationships Displaying related posts in Posts Table Pro (and other solutions)Resolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #22992
    logicelflogicelf
    Participant

    Hi folks,

    I'd like to display related posts registered with MB_Relationships_API::register() in a table created with Posts Table Pro.

    Posts Table Pro can display a column with any custom field, including the ACF relationship field. This is perfect for my needs, but I'd like to use MB instead of ACF (I have a lifetime MB bundle, and I prefer it to ACF).

    The issue is that the relationships are stored by MB in a custom table, not in a custom field, which means that Posts Table Pro (and any other solution which looks at custom fields) can't directly access the list of related posts for a given post.

    I'm thinking that the easiest way to solve this would be to register a custom field which keeps (and updates) an array of the related post IDs from the wp_mb_relationships table for the post in question, and looks up the post title and URL for each, so that they can be passed to Posts Table Pro.

    Can someone tell me if I'm on the right track here? I'd be very grateful for any suggestions, because I'm not that experienced with this stuff and I'm still learning to use MB to its full potential.

    Thaks very much,

    James

    #22997
    Long NguyenLong Nguyen
    Moderator

    Hi there,

    Meta Box supports the field post which similar to the Relationships extension. The difference is it saves the post ID in the database as the post meta like other fields. Please try to use it with the plugin Posts Table Pro.

    See more in this documentation https://docs.metabox.io/fields/post/.

    #23039
    logicelflogicelf
    Participant

    Thanks, Long - I hadn't seen post. I'll have a play with that instead.

    #23065
    logicelflogicelf
    Participant

    Hi Long,

    The post field works, but (as far as I can see) there's no way to make the associated post ID relationships reciprocal (as can be done with MB Relationships).

    Is this correct? If so, I'll have to build a query to gather the related posts, then pass the parsed titles and slugs to Posts Table Pro to render.

    #23069
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Yes, the field post just supports selecting post (post types) and save the post ID as the post meta so it does not have the feature reciprocal like the Relationships extension.

    #23075
    logicelflogicelf
    Participant

    Okay, thanks.

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