I have a Setting page:
Setting Page ID: global-settings
Option name: global-settings
Field Group ID:basic-settings
Field Name: 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’]
$value = rwmb_meta( $alpha-business_name, ['object_type' => 'setting'], ‘global-settings’ );
$value = rwmb_meta( ‘alpha-business_name, ['object_type' => 'setting'], ‘global’-settings);
If you are using the shortcode, the attribute
object_type should be assigned the value
[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;
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.
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
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"]