Show content in frontend

Support MB Template Show content in frontend

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1315
    MauriceMaurice
    Participant

    Hi there,

    I am not good in PHP so... https://metabox.io/plugins/meta-box-template/

    Works great! But how to show the content in the frontend?

    Hope to hear.

    Greetings,
    Maurice

    #1322
    Tan NguyenTan 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
    MauriceMaurice
    Participant

    Hi Tan,

    Thanks!

    I thought I could design without coding πŸ™‚ ?

    "With MB 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 NguyenTan 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
    MauriceMaurice
    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 MB 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 TranAnh 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 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Show content in frontend’ is closed to new replies.