Use Settings Page for Site title
Support › MB Settings Page › Use Settings Page for Site title
- This topic has 4 replies, 2 voices, and was last updated 3 years, 6 months ago by
Long Nguyen.
-
AuthorPosts
-
December 29, 2021 at 4:17 PM #32906
Ripal P.
ParticipantHi,
I have a Setting page:
Setting Page ID: global-settingsOption name: global-settings
Custom Fields:
Field Group ID:basic-settingsField Name: Business Name
ID: alpha-business-nameNow 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>December 30, 2021 at 9:59 AM #32919Long Nguyen
ModeratorHi,
If you are using the shortcode, the attribute
object_type
should be assigned the valuesetting
.[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/#examplesDecember 30, 2021 at 4:24 PM #32925Ripal P.
ParticipantThanks 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.December 30, 2021 at 4:53 PM #32926Ripal P.
ParticipantHi 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
December 30, 2021 at 10:35 PM #32938Long Nguyen
ModeratorHi,
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"]
-
AuthorPosts
- You must be logged in to reply to this topic.