Custom Fields
Re-Envisioned
Support MB Settings Page Use Settings Page for Site title

  • Creator
    Topic
  • #32906
    Ripal P.
    Participant

    Hi,
    I have a Setting page:
    Setting Page ID: global-settings

    Option name: global-settings

    Custom Fields:
    Field Group ID:basic-settings

    Field Name: Business Name
    ID: alpha-business-name

    Now I am trying to use the name of the business into posts (blogs) and other custom posts (faqs) so that once the website is ready and delivered the client can change the name of the business (they have working title for their business but not finalised yet).

    While creating blog posts and FAQs, I need to use the name of the business a lot and I need to make it dynamic. I can't write code so tell me what I am doing wrong here:

    The post is as follows:
    Our vehicles are maximum 3 years old. At [BUSINESS NAME SHOULD BE HERE], we take presentation and look of our vehicles very seriously. All the photos you see on our website are of our own vehicles.

    I have tried a lot of these in the the place where it says [BUSINESS NAME SHOULD BE HERE]:
    [rwmb_meta id="alpha-business_name" object_type="mb_settings_pages" object_id=“global-settings”]

    [oxygen data='custom_metabox_content' settings_page='global-settings' settings_path='alpha-business_name' settings_page='global-settings’]

    <div>
    $value = rwmb_meta( $alpha-business_name, ['object_type' => 'setting'], ‘global-settings’ );
    echo $value;

    $value = rwmb_meta( ‘alpha-business_name, ['object_type' => 'setting'], ‘global’-settings);
    </div>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #32919
    Long Nguyen
    Moderator

    Hi,

    If you are using the shortcode, the attribute object_type should be assigned the value setting.

    [rwmb_meta id="alpha-business-name" object_type="setting" object_id="global-settings"]

    and the field ID looks wrong.

    $value = rwmb_meta( 'alpha-business-name', ['object_type' => 'setting'], 'global-settings' );
    echo $value;

    Refer to the documentation
    https://docs.metabox.io/extensions/mb-settings-page/#getting-field-value
    https://docs.metabox.io/shortcode/#examples

    #32925
    Ripal P.
    Participant

    Thanks for the quick reply Long but the shortcode doesn't work. Just to clarify
    I have created a Post Type named FAQ and for the answer field type is WYSIWYG editor. I am using the shortcode for the pulling website name from Setting page. I used the php you mentioned above as well but that also doesn't work in WYSIWYG editor. The page is designed using OXYGEN page builder.

    #32926
    Ripal P.
    Participant

    Hi Long, I just tried using the shortcode that you gave above in blog post and it works. But when i enter into the custom post type that I created and add the shortcode into the WYSIWYG editor, it doesn't work. Do you think its the WYSIWYG editor? or is it because its in custom post type

    #32938
    Long Nguyen
    Moderator

    Hi,

    If you want to run the shortcode in the WYSIWYG content, please follow this documentation https://docs.metabox.io/fields/wysiwyg/#template-usage

    You can also use the helper shortcode to render the content and shortcode inside. For example

    [rwmb_meta id="wysiwyg_field_id" object_id="15"]
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.