Custom Fields
Re-Envisioned
Support General how to get my MB to display?

This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 1 year, 9 months ago.

  • Creator
    Topic
  • #6698

    yorai85
    Participant

    hello there,

    i’m new to MB, and i can’t figure out how to get my meta-boxes do display.
    i read through all the relevant documentation – but it’s unclear which part of your code examples should go where, and which parts should be changed.

    i have the following plugins isntalled:
    – meta box
    – MB updater
    – MB Settings Page
    – MB Custom post types
    – MB Box Builder
    – MB includ exclud
    – MB for Yoast SEO

    so i created 2 custom post types using MB Custom Post Types, 1 of them with 2 custom taxonomies.
    each CPT generetaed a code, which i copied to my theme’s function.php file.
    the posts are shown on the front-end, but the custom taxonomies are not.

    then i create 2 meta boxes (with custom fields) using MB Box builder, and assinged them to my 2 custom post types.

    i filled the custom fields with content for all instances of that post types – but they are not shown on the page.

    i think that maybe i am missing something(s) about using meta box to actually show the information on the site.

    can you please help me with this few questions:

    .1 do i need to copy the code genereated by MB Custom Post Type for each CPT and put it in functions.php?

    2. do i need to follow the steps in this page: https://metabox.io/docs/registering-meta-boxes/ (copy the code to register meta-box) even though i have MB Builder / MB Custom Post Types installed?

    3. also- the code in that page start with the line:
    add_filter( ‘rwmb_meta_boxes’, ‘YOURPREFIX_register_meta_boxes’ );
    this line is missing from the code generated by MB Custom Post Types (as mentioned in question 1). is this ok or should i add that line?

    4. should i copy-paste any code to register my custom taxonimies and custom fields?

    5. in the tutorial for “Get custom field value and display in the front end” (this page: https://metabox.io/docs/get-meta-value/) you say: “To get field meta value, use this function:” and show some code – but it’s unclear where to put this code?

    6. in that same page you say: “To display field value in the frontend, just put the code below in your theme’s template file:” and show some PHP code – but – my template using .yaml files, not .php files.
    how can i get my custom fields to show on the page?

    thank you very much!

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #6709

    Anh Tran
    Keymaster

    Hi,

    Glad that you asked these questions. Please find my answers below:

    1. do i need to copy the code genereated by MB Custom Post Type for each CPT and put it in functions.php?

    No. The plugin does all the work for you.

    2. do i need to follow the steps in this page: https://metabox.io/docs/registering-meta-boxes/ (copy the code to register meta-box) even though i have MB Builder / MB Custom Post Types installed?

    No. That are the purpose of the extensions, e.g. without touching code. You don’t need to copy the code.

    3. also- the code in that page start with the line:
    add_filter( ‘rwmb_meta_boxes’, ‘YOURPREFIX_register_meta_boxes’ );
    this line is missing from the code generated by MB Custom Post Types (as mentioned in question 1). is this ok or should i add that line?

    No. As you already used Meta Box Builder extension, you don’t need to copy the code.

    4. should i copy-paste any code to register my custom taxonimies and custom fields?

    No. The MB Custom Post Types already did that for you.

    5. in the tutorial for “Get custom field value and display in the front end” (this page: https://metabox.io/docs/get-meta-value/) you say: “To get field meta value, use this function:” and show some code – but it’s unclear where to put this code?

    You should find the template files of your theme and paste the code there. Each theme has several PHP template files. You just need to find which file displays your pages, open it and paste the code in that file. To understand about template files of a WordPress theme, please read this documentation.

    6. in that same page you say: “To display field value in the frontend, just put the code below in your theme’s template file:” and show some PHP code – but – my template using .yaml files, not .php files.

    I’m not sure why your theme uses .yaml files. Can you please tell us about your system? Maybe you use a very different system that overwrite WordPress template system.

    Again, to understand about WordPress themes and template files, please read these pages:

    https://codex.wordpress.org/Stepping_Into_Templates
    https://developer.wordpress.org/themes/basics/template-files/

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.