Созданная на заказ тема WordPress с подчеркиванием

Я пытаюсь включить несколько настраиваемых полей, которые я создал в свой файл functions.php, чтобы они были родными для темы, над которой я работаю. Однако они не отображаются на экранах редактирования сообщений, для которых я их установил.

Я включил плагин acf в свою тему, используя следующий код в файле functions.php: include_once('advanced-custom-fields/acf.php');

Я также экспортировал поля в php и скопировал и вставил код в functions.php моей темы. Может ли кто-нибудь сказать мне, что я делаю неправильно?

Ниже мой экспортированный код

define( 'ACF_LITE', true );

include_once('/advanced-custom-fields/acf.php');

если (функция_существует('зарегистрировать_полевую_группу')):

register_field_group(array (
    'id' => 'acf_about-us',
    'title' => 'About Us',
    'fields' => array (
        array (
            'key' => 'field_586e22820cdf9',
            'label' => 'About Us',
            'name' => 'about_us',
            'type' => 'text',
            'instructions' => 'Enter Title for about us here',
            'required' => 1,
            'default_value' => '',
            'placeholder' => 'Enter Title for about us here',
            'prepend' => '',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
        array (
            'key' => 'field_586e22f80cdfa',
            'label' => 'Establised At',
            'name' => 'establised_at',
            'type' => 'text',
            'required' => 1,
            'default_value' => '',
            'placeholder' => 'When where you established',
            'prepend' => '',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
    ),
    'location' => array (
        array (
            array (
                'param' => 'page',
                'operator' => '==',
                'value' => '15',
                'order_no' => 0,
                'group_no' => 0,
            ),
        ),
    ),
    'options' => array (
        'position' => 'normal',
        'layout' => 'default',
        'hide_on_screen' => array (
        ),
    ),
    'menu_order' => 0,
));
register_field_group(array (
    'id' => 'acf_food-menu',
    'title' => 'Food Menu',
    'fields' => array (
        array (
            'key' => 'field_58808cfded5b3',
            'label' => 'Price',
            'name' => 'price',
            'type' => 'text',
            'required' => 1,
            'default_value' => '',
            'placeholder' => '',
            'prepend' => '',
            'append' => '',
            'formatting' => 'html',
            'maxlength' => '',
        ),
        array (
            'key' => 'field_5881f02f46739',
            'label' => 'Currency',
            'name' => 'currency',
            'type' => 'select',
            'required' => 1,
            'choices' => array (
                '$' => '$',
                '&euro' => '€',
            ),
            'default_value' => '',
            'allow_null' => 0,
            'multiple' => 0,
        ),
        array (
            'key' => 'field_5880aceb6427c',
            'label' => 'Food Category',
            'name' => 'food_category',
            'type' => 'checkbox',
            'required' => 1,
            'choices' => array (
                'breakfast' => 'Breakfast',
                'lunch' => 'Lunch',
                'dinner' => 'Dinner',
                'party' => 'Party',
                'drinks' => 'Drinks',
            ),
            'default_value' => 'breakfast : Breakfast',
            'layout' => 'vertical',
        ),
    ),
    'location' => array (
        array (
            array (
                'param' => 'post_type',
                'operator' => '==',
                'value' => 'foodmenu',
                'order_no' => 0,
                'group_no' => 0,
            ),
        ),
    ),
    'options' => array (
        'position' => 'normal',
        'layout' => 'no_box',
        'hide_on_screen' => array (
        ),
    ),
    'menu_order' => 0,
));
register_field_group(array (
    'id' => 'acf_footer-details',
    'title' => 'Footer details',
    'fields' => array (
        array (
            'key' => 'field_5878f731da3ad',
            'label' => 'footer image',
            'name' => 'footer_image',
            'type' => 'image',
            'instructions' => 'Footer Image Goes Here',
            'save_format' => 'object',
            'preview_size' => 'medium',
            'library' => 'all',
        ),
        array (
            'key' => 'field_5878f756da3ae',
            'label' => 'footer content',
            'name' => 'footer_content',
            'type' => 'text',
            'instructions' => 'footer content goes here',
            'default_value' => '',
            'placeholder' => '',
            'prepend' => '',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
        array (
            'key' => 'field_58794f98697fa',
            'label' => 'Social Icons',
            'name' => '',
            'type' => 'tab',
        ),
        array (
            'key' => 'field_58794d05697f8',
            'label' => 'Facebook Username',
            'name' => 'facebook_username',
            'type' => 'text',
            'instructions' => 'Enter Your Facebook Username Here',
            'default_value' => '',
            'placeholder' => 'ajbeacon',
            'prepend' => '',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
        array (
            'key' => 'field_58794c93697f7',
            'label' => 'Twitter Username',
            'name' => 'twitter_username',
            'type' => 'text',
            'instructions' => 'Enter Twitter Username Here',
            'default_value' => '',
            'placeholder' => 'ajbeacon',
            'prepend' => '@',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
        array (
            'key' => 'field_58794d65697f9',
            'label' => 'Google Plus Username',
            'name' => 'google_plus_username',
            'type' => 'text',
            'instructions' => 'Enter Your Google Plus Username Here',
            'default_value' => '',
            'placeholder' => '+ajbeacon',
            'prepend' => '',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
    ),
    'location' => array (
        array (
            array (
                'param' => 'page',
                'operator' => '==',
                'value' => '15',
                'order_no' => 0,
                'group_no' => 0,
            ),
        ),
    ),
    'options' => array (
        'position' => 'normal',
        'layout' => 'default',
        'hide_on_screen' => array (
        ),
    ),
    'menu_order' => 0,
));
register_field_group(array (
    'id' => 'acf_opening-time',
    'title' => 'Opening Time',
    'fields' => array (
        array (
            'key' => 'field_58795883ae60c',
            'label' => 'Opening Time',
            'name' => '',
            'type' => 'tab',
        ),
        array (
            'key' => 'field_587957a30aecf',
            'label' => 'Breakfast',
            'name' => 'breakfast',
            'type' => 'wysiwyg',
            'required' => 1,
            'default_value' => '',
            'toolbar' => 'full',
            'media_upload' => 'yes',
        ),
        array (
            'key' => 'field_587957f00aed0',
            'label' => 'Lunch',
            'name' => 'lunch',
            'type' => 'wysiwyg',
            'required' => 1,
            'default_value' => '',
            'toolbar' => 'full',
            'media_upload' => 'yes',
        ),
        array (
            'key' => 'field_587958310aed1',
            'label' => 'Dinner',
            'name' => 'dinner',
            'type' => 'wysiwyg',
            'required' => 1,
            'default_value' => '',
            'toolbar' => 'full',
            'media_upload' => 'yes',
        ),
        array (
            'key' => 'field_58795c760f586',
            'label' => 'Direction',
            'name' => '',
            'type' => 'tab',
        ),
        array (
            'key' => 'field_58795c900f587',
            'label' => 'Address',
            'name' => 'address',
            'type' => 'text',
            'default_value' => '',
            'placeholder' => 'Enter Address Here',
            'prepend' => '',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
        array (
            'key' => 'field_58795d8550af4',
            'label' => 'Contact Details',
            'name' => '',
            'type' => 'tab',
        ),
        array (
            'key' => 'field_58795da950af5',
            'label' => 'Email',
            'name' => 'email',
            'type' => 'email',
            'required' => 1,
            'default_value' => '',
            'placeholder' => 'Enter contact Email Address here',
            'prepend' => '',
            'append' => '',
        ),
        array (
            'key' => 'field_58795dde50af6',
            'label' => 'Phone Number',
            'name' => 'phone_number',
            'type' => 'text',
            'required' => 1,
            'default_value' => '',
            'placeholder' => 'Enter Reachable Contact Phone Number Here.',
            'prepend' => '',
            'append' => '',
            'formatting' => 'html',
            'maxlength' => '',
        ),
    ),
    'location' => array (
        array (
            array (
                'param' => 'page',
                'operator' => '==',
                'value' => '15',
                'order_no' => 0,
                'group_no' => 0,
            ),
        ),
    ),
    'options' => array (
        'position' => 'normal',
        'layout' => 'default',
        'hide_on_screen' => array (
        ),
    ),
    'menu_order' => 0,
));
register_field_group(array (
    'id' => 'acf_signature-dishes',
    'title' => 'Signature Dishes',
    'fields' => array (
        array (
            'key' => 'field_5878ff13d8ea4',
            'label' => 'Signature Dishes',
            'name' => 'signature_dishes',
            'type' => 'text',
            'required' => 1,
            'default_value' => '',
            'placeholder' => 'Enter Title Here Please',
            'prepend' => '',
            'append' => '',
            'formatting' => 'none',
            'maxlength' => '',
        ),
    ),
    'location' => array (
        array (
            array (
                'param' => 'page',
                'operator' => '==',
                'value' => '15',
                'order_no' => 0,
                'group_no' => 0,
            ),
        ),
    ),
    'options' => array (
        'position' => 'normal',
        'layout' => 'no_box',
        'hide_on_screen' => array (
        ),
    ),
    'menu_order' => 0,
));

конец;


person 95media    schedule 22.01.2017    source источник
comment
Извините, но я не могу понять, о чем вы здесь спрашиваете.   -  person Joe C    schedule 22.01.2017
comment
@joe, это то, что я имел в виду, извините за эту пропущенную информацию. Я пытаюсь включить несколько настраиваемых полей, которые я создал в своем файле functions.php, чтобы они были родными для темы, над которой я работаю. Однако они не отображаются на экранах редактирования сообщений, для которых я их установил. Я включил плагин acf в свою тему, используя следующий код в файле functions.php: include_once('advanced-custom-fields/acf.php');   -  person 95media    schedule 22.01.2017


Ответы (1)


Спасибо за публикацию вашего кода, который очень помог.

код правильный, единственная возможная ошибка связана с включением acf.php

если у вас есть доступ к FTP, поместите папку «advanced-custom-fields» рядом с файлом functions.php. (в том же каталоге)

теперь в functions.php (код, который вы разместили выше) найдите эту строку:

include_once('/advanced-custom-fields/acf.php');

замените его на это:

 include_once('advanced-custom-fields/acf.php');

дайте мне знать, если это не сработает.

Спасибо

person Ali Salti    schedule 23.01.2017
comment
Благодарю. Я сделал это, и это не работает. это работает только когда я устанавливаю настраиваемые поля - person 95media; 23.01.2017
comment
вот моя файловая структура в папке моей темы, которую я загрузил в Dropbox. в раскрывающемся списке. com/s/9i46rl6wtnw5kdd/ - person 95media; 23.01.2017
comment
это работает на моем wordpress ... в любом случае, вы получаете какие-либо ошибки? - person Ali Salti; 24.01.2017
comment
Хорошо, вы активировали плагин расширенных настраиваемых полей? - person 95media; 24.01.2017
comment
нет, я переместил его из папки плагинов в папку темы - person Ali Salti; 24.01.2017
comment
Никаких ошибок. Пришлось активировать плагин и скрыть его пользовательский интерфейс от пользователей. - person 95media; 24.01.2017
comment
Ничего, если я увижу, как вы ссылаетесь на плагин в папке вашей темы? - person 95media; 24.01.2017
comment
dropbox.com/s/16e73ifcw6x099u/test.JPG?dl=0 У меня установлен новый WordPress с темой Blankslate. - person Ali Salti; 24.01.2017
comment
dropbox.com/s/fll2qmhbt19htab/functions.php?dl=0 и это файл functions.php, который я использую. Я скопировал ваш код и просто изменил путь include_once - person Ali Salti; 24.01.2017
comment
ваше имя папки с расширенными пользовательскими полями неверно. s в конце отсутствует - person Ali Salti; 24.01.2017