Show content in frontend
Support › MB Template › Show content in frontend
- This topic has 5 replies, 3 voices, and was last updated 10 years, 2 months ago by
Anh Tran.
-
AuthorPosts
-
August 28, 2015 at 9:43 PM #1315
Maurice
ParticipantHi 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,
MauriceAugust 29, 2015 at 2:34 AM #1322Tan Nguyen
ParticipantHi Maurice,
Thanks for using our plugins, to display field on the frontend, you can follow this guide.
Have a nice day man π
Tan Nguyen
August 29, 2015 at 3:22 AM #1323Maurice
ParticipantHi 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-templateWhat 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!
MauriceAugust 29, 2015 at 1:52 PM #1330Tan Nguyen
ParticipantHi Maurice,
Yes, we do have shortcode to display on singular pages π
[rwmb_meta meta_key="$meta_key"][/rwmb_meta]Where
$meta_keyis 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.
August 29, 2015 at 2:43 PM #1331Maurice
ParticipantThanks 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!
August 31, 2015 at 8:22 AM #1342Anh Tran
KeymasterHi Maurice,
If you want to display meta value in a template file like
single.php, please open that file (notfunctions.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_IDandFIELD_TYPEto your specific field ID and field type. -
AuthorPosts
- The topic ‘Show content in frontend’ is closed to new replies.