Display field on all pages
- This topic has 6 replies, 2 voices, and was last updated 2 years, 2 months ago by
Peter.
-
AuthorPosts
-
August 21, 2023 at 3:41 PM #42991
Dam87212
ParticipantHello, 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' ], ], ];August 21, 2023 at 6:42 PM #42992Dam87212
ParticipantPlease help.
August 21, 2023 at 9:07 PM #42993Peter
ModeratorHello,
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/
August 22, 2023 at 6:02 PM #42996Dam87212
ParticipantCan I do this without additional plugin? I bought MB Group.
August 22, 2023 at 6:04 PM #42997Dam87212
ParticipantI want to display fields in footer. On all pages I want have the same of course.
August 22, 2023 at 10:06 PM #43002Dam87212
ParticipantI have one question yet, how can I hide some fields from some pages? Now all fields are on each page.
August 23, 2023 at 8:59 PM #43016Peter
ModeratorHello,
>> Can I do this without additional plugin? I bought MB 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
-
AuthorPosts
- You must be logged in to reply to this topic.