• Resolved Drew Nakari

    (@drew-nakari)


    Hi,

    I’m fairly new to Meta Box and not sure if this is even possible… I created a few new post types and each of them has their own set of custom fields. Now I need to create several different combinations and display them on front end as posts.

    For example, I have post types Gear, Weapons, Consumables etc. that have custom fields (mostly just text). Then there’s the Character post type that has custom fields type “post”. It works fine in backend – create new Characted post and select a Gear post, a Weapons post etc. But on frontend I get a lot of info about the “linked” posts (date, author, title, status etc.) and even [post_content] but the custom fields are missing.

    How to I get the values from custom fields (and perhaps their names) of the “linked” posts? Preferably without all other information regarding date, author, status etc.

    Thank you 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi Drew,

    To get custom fields’ values, please refer to this docs.

    In this case, you have post A (character) that has a custom field of type “post”, and you select a post B. Then you want to get custom fields’ values of post B to display on the frontend. So the steps are below:

    $post_a_id = get_the_ID(); // current post ID, or you can pass any ID of post A.
    $post_b_id = rwmb_meta( 'field_post' ); // change it to your field ID.
    $post_b_field = rwmb_meta( 'field_b_id', '', $post_b_id ); // change it to your field ID.
    Thread Starter Drew Nakari

    (@drew-nakari)

    Hi,

    thank you for your reply, you summed it up perfectly.

    So I change both ‘field_post’ and ‘field_b_id’ to ID number of the custom field that is in post B?

    Plugin Author Anh Tran

    (@rilwis)

    Yes, that’s right. Also, please refer to the docs that I mentioned above to learn more how it works.

    Thread Starter Drew Nakari

    (@drew-nakari)

    Thank you for your help 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Append post content to another post’ is closed to new replies.