Display field on all pages

Support General Display field on all pages

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #42991
    Dam87212Dam87212
    Participant

    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'
                        ],
                    ],
                ];
    #42992
    Dam87212Dam87212
    Participant

    Please help.

    #42993
    PeterPeter
    Moderator

    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/

    #42996
    Dam87212Dam87212
    Participant

    Can I do this without additional plugin? I bought MB Group.

    #42997
    Dam87212Dam87212
    Participant

    I want to display fields in footer. On all pages I want have the same of course.

    #43002
    Dam87212Dam87212
    Participant

    I have one question yet, how can I hide some fields from some pages? Now all fields are on each page.

    #43016
    PeterPeter
    Moderator

    Hello,

    >> 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

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.