@frilix
Иногда "творю"

Wordpress Theme Customization API?

Доброго времени суток. Пытаюсь сделать настройки темы на WP, для этого написал несколько разделов и полей для них, но при использовании возникает проблема, пишет Настройка: Загрузка… и все.

13acc2cae1aa4e9097c228db02c891f5.png

В чем может быть проблема? Код привожу ниже.

<?php
/**
 * Defines customizer options
 *
 * @package Customizer Library Demo
 */

function customizer_library_topshop_options() {


	// Stores all the controls that will be added
	$options = array();

	// Stores all the sections to be added
	$sections = array();

	// Adds the sections to the $options array
	$options['sections'] = $sections;

	
	// Favicon
	$section = 'topshop-favicon';
    
	$sections[] = array(
		'id' => $section,
		'title' => __( 'Favicon', 'topshop' ),
		'priority' => '10',
		'description' => __( 'Add a favicon to your website', 'topshop' )
	);
    
	$options['topshop-header-favicon'] = array(
		'id' => 'topshop-header-favicon',
		'label'   => __( 'Favicon', 'topshop' ),
		'section' => $section,
		'type'    => 'image',
		'default' => '',
	);
	
	// Настройка текста 404
	$section = 'topshop-website';

	$sections[] = array(
			'id' => $section,
			'title' => __( 'Настройка текста в 404 ', 'topshop' ),
			'priority' => '20'
	);
	
	$options['topshop-website-error-head'] = array(
			'id' => 'topshop-website-error-head',
			'label'   => __( '404 Error Page Heading', 'topshop' ),
			'section' => $section,
			'type'    => 'text',
			'default' => __( 'Oops! <span>404</span>', 'topshop'),
			'description' => __( 'Enter the heading for the 404 Error page', 'topshop' )
	);
	
	$options['topshop-website-error-msg'] = array(
			'id' => 'topshop-website-error-msg',
			'label'   => __( 'Error 404 Message', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __( 'It looks like that page does not exist. <br />Return home or try a search', 'topshop'),
			'description' => __( 'Enter the default text on the 404 error page (Page not found)', 'topshop' )
	);
	
	$options['topshop-website-nosearch-msg'] = array(
			'id' => 'topshop-website-nosearch-msg',
			'label'   => __( 'No Search Results', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'topshop'),
			'description' => __( 'Enter the default text for when no search results are found', 'topshop' )
	);
	

	// Главная
	$section = 'topshop-home';

	$sections[] = array(
			'id' => $section,
			'title' => __( 'Настройка главной ', 'topshop' ),
			'priority' => '30'
	);
	
	$options['topshop-home-text'] = array(
			'id' => 'topshop-home-text',
			'label'   => __( 'Описание курсов', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'topshop'),
			'description' => __( 'Введите текст для блока описания курсов', 'topshop' )
	);
	
	$options['topshop-home-shop'] = array(
			'id' => 'topshop-home-shop',
			'label'   => __( 'Наш онлайн магазин', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __( '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quo veniam provident voluptate itaque ut, corporis est et earum illo, delectus, eos. Reprehenderit necessitatibus quis nihil repudiandae reiciendis fugiat dolor voluptatum.</p><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut necessitatibus obcaecati minus dolorum temporibus, possimus modi veniam. Optio, itaque odit. Fugiat porro illo, numquam at odio non laborum commodi iste!</p>', 'topshop'),
	);
	
	// Слайдер
	$section = 'topshop-slider';

	$sections[] = array(
			'id' => $section,
			'title' => __( 'Слайдер ', 'topshop' ),
			'priority' => '40'
	);
	
	$options['topshop-slider-img1'] = array(
			'id' => 'topshop-slider-img1',
			'label'   => __( 'Картинка 1', 'topshop' ),
			'section' => $section,
			'type'    => 'image',
			'default' => '',
	);
	
	$options['topshop-slider-img2'] = array(
			'id' => 'topshop-slider-img2',
			'label'   => __( 'Картинка 2', 'topshop' ),
			'section' => $section,
			'type'    => 'image',
			'default' => '',
	);
	
	$options['topshop-slider-img3'] = array(
			'id' => 'topshop-slider-img3',
			'label'   => __( 'Картинка 3', 'topshop' ),
			'section' => $section,
			'type'    => 'image',
			'default' => '',
	);
	
	$options['topshop-slider-img4'] = array(
			'id' => 'topshop-slider-img4',
			'label'   => __( 'Картинка 4', 'topshop' ),
			'section' => $section,
			'type'    => 'image',
			'default' => '',
	);
		
	// Соц Сети
	$section = 'topshop-social';

	$sections[] = array(
			'id' => $section,
			'title' => __( 'Социальные сети', 'topshop' ),
			'priority' => '50'
	);
	
	$options['topshop-social-vk'] = array(
			'id' => 'topshop-social-vk',
			'label'   => __( 'Ссылка на группу VK', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __('#'),
	);
	
	$options['topshop-social-ok'] = array(
			'id' => 'topshop-social-ok',
			'label'   => __( 'Ссылка на группу в Одноклассниках', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __('#'),
	);
	
	$options['topshop-social-skype'] = array(
			'id' => 'topshop-social-skype',
			'label'   => __( 'Введите ваш Skype', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __('#'),
	);
	
	$options['topshop-social-youtube'] = array(
			'id' => 'topshop-social-youtube',
			'label'   => __( 'Ссылка на канал на Youtube', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __('#'),	
	);
	
	$options['topshop-social-instagram'] = array(
			'id' => 'topshop-social-instagram',
			'label'   => __( 'Ссылка на Instagram', 'topshop' ),
			'section' => $section,
			'type'    => 'textarea',
			'default' => __('#'),
	);
	
	// Контактная информация

	// Adds the sections to the $options array
	$options['sections'] = $sections;

	$customizer_library = Customizer_Library::Instance();
	$customizer_library->add_options( $options );
}
add_action( 'init', 'customizer_library_topshop_options' );
  • Вопрос задан
  • 159 просмотров
Решения вопроса 1
@frilix Автор вопроса
Иногда "творю"
Проблему решил перезаливкой файлов
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы