Support Forum
Support › Meta Box Template › Show content in frontend
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
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
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
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.
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!
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.