Custom Fields
Re-Envisioned
Support Meta Box Template Show content in frontend

This topic contains 5 replies, has 3 voices, and was last updated by  Anh Tran 3 years, 11 months ago.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #1322

    Tan Nguyen
    Participant

    Hi Maurice,

    Thanks for using our plugins, to display field on the frontend, you can follow this guide.

    Have a nice day man 🙂

    Tan Nguyen

    #1323

    Maurice
    Participant

    Hi Tan,

    Thanks!

    I thought I could design without coding 🙂 ?

    “With Meta Box Template, you can create custom meta boxes much more easily, even if you don’t know PHP or coding”

    Iam “if you don’t know PHP or coding” 😉

    How can I easily display a content box to a single page for example?

    I tested this one “If you register single meta box”:
    https://metabox.io/docs/meta-box-template/#section-define-meta-boxes-and-custom-fields-using-template

    What should be the code for that for the frontend?

    Is there not a way to put a shortcode or something that just calls the whole metabox?

    Hope you can help me out with this.

    Thanks!
    Maurice

    #1330

    Tan Nguyen
    Participant

    Hi Maurice,

    Yes, we do have shortcode to display on singular pages 🙂

    
    [rwmb_meta meta_key="$meta_key"][/rwmb_meta]
    

    Where $meta_key is the field ID.

    To display post meta on other pages or specify post id meta, you can add post_id attribute, like so:

    
    [rwmb_meta post_id="$post_id" meta_key="$meta_key"][/rwmb_meta]
    

    Best regards

    Tan Nguyen.

    #1331

    Maurice
    Participant

    Thanks Tan!

    Shortcodes are clear now 🙂

    But if I want to display at, for example, single.php.

    What woud be te code to put there? Do I also need to put a code to functions.php?

    Sorry, want to learn/understand :).

    Can you give me an instruction + code for the example you made for Meta Box Template. In the way I can get it on the frontend by single.php?

    So I see What to do :).

    Thanks! Also for your patiends and quick responds!

    #1342

    Anh Tran
    Keymaster

    Hi Maurice,

    If you want to display meta value in a template file like single.php, please open that file (not functions.php) and insert the following code at the place you want to show the value:

    echo rwmb_meta( 'FIELD_ID', 'type=FIELD_TYPE' );

    Don’t forget to change FIELD_ID and FIELD_TYPE to your specific field ID and field type.

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

The topic ‘Show content in frontend’ is closed to new replies.