Support Forum
Hello, I have a question:
1) How can I create field and display it on all pages? I have contact information in footer and I want to have possibility edit it in admin panel in one place (for example homepage page). When I want to display it in theme, it shows only on homepage. I have to add text to this field on every page. How can I do this?
My code look:
$meta_boxes[] = [
'title' => 'Stopka kontakt',
'post_types' => 'page',
'fields' => [
[
'name' => 'Stopka kontakt opis',
'id' => 'stopka-kontakt-opis',
'type' => 'textarea'
],
[
'name' => 'Numer telefonu',
'id' => 'stopka-kontakt-telefon',
'type' => 'text'
],
[
'name' => 'Adres email',
'id' => 'stopka-kontakt-email',
'type' => 'text'
],
],
];
Please help.
Hello,
If you want to display one field value on all pages, please try to use the settings page, it works like the theme options. Please follow the documentation https://docs.metabox.io/extensions/mb-settings-page/
Can I do this without additional plugin? I bought Meta Box Group.
I want to display fields in footer. On all pages I want have the same of course.
I have one question yet, how can I hide some fields from some pages? Now all fields are on each page.
Hello,
>> Can I do this without additional plugin? I bought Meta Box Group.
Yes, it is possible. You can use the code to output the field value and add the specific post/page ID to the third parameter.
rwmb_meta( 'custom_field_id', '', 123 );
where 123 is the post ID. Read more in the documentation https://docs.metabox.io/functions/rwmb-meta/
>> how can I hide some fields from some pages?
You can use the plugin MB Conditional Logic to hide some fields on some pages by page ID. Read more in the documentation https://docs.metabox.io/extensions/meta-box-conditional-logic/#toggle-by-other-elements