• Как отключить дефолтное значение в footer.php из кастомайзера?

    andre_revin
    @andre_revin Автор вопроса
    Денис! Спасибо большое за помощь. Ты отличный специалист своего дела.
  • Как отключить дефолтное значение в footer.php из кастомайзера?

    andre_revin
    @andre_revin Автор вопроса
    Да я так пробовал, не работает, текст в футере по умолчанию не выводится.
  • Как отключить дефолтное значение в footer.php из кастомайзера?

    andre_revin
    @andre_revin Автор вопроса
    Спасибо за ответ! Я не совсем понял, что значит "при выводе в шалблоне ..."
    1. В файле footer.php вставить этот код?
    2. В файле function.php вставить?
  • Как отключить дефолтное значение в footer.php из кастомайзера?

    andre_revin
    @andre_revin Автор вопроса
    Как добавить дефолтный текст?
  • Как сделать настройку футера в WordPress теме через кастомайзер?

    andre_revin
    @andre_revin Автор вопроса
    PHP 5.2
     Я убрал эту строку и все заработало. Насколько это правильно?
    $wp_customize->selective_refresh->add_partial($setting_name, array(
            'selector' => '.footer-desc',
            'render_callback' => function() use ($setting_name) {
                return nl2br(get_theme_mod($setting_name));
            }
  • Как сделать настройку футера в WordPress теме через кастомайзер?

    andre_revin
    @andre_revin Автор вопроса
    line 198
    'render_callback' => function() use ($setting_name) {
  • Как сделать настройку футера в WordPress теме через кастомайзер?

    andre_revin
    @andre_revin Автор вопроса
    1. Да
    2.Да

    <?php
    /**
     * Redy functions and definitions
     *
     * @link https://developer.wordpress.org/themes/basics/theme-functions/
     *
     * @package Redy
     */
    
    if ( ! function_exists( 'redy_setup' ) ) :
    /**
     * Sets up theme defaults and registers support for various WordPress features.
     *
     * Note that this function is hooked into the after_setup_theme hook, which
     * runs before the init hook. The init hook is too late for some features, such
     * as indicating support for post thumbnails.
     */
    function redy_setup() {
    	/*
    	 * Make theme available for translation.
    	 * Translations can be filed in the /languages/ directory.
    	 * If you're building a theme based on Redy, use a find and replace
    	 * to change 'redy' to the name of your theme in all the template files.
    	 */
    	load_theme_textdomain( 'redy', get_template_directory() . '/languages' );
    
    	// Add default posts and comments RSS feed links to head.
    	add_theme_support( 'automatic-feed-links' );
    
    	/*
    	 * Let WordPress manage the document title.
    	 * By adding theme support, we declare that this theme does not use a
    	 * hard-coded <title> tag in the document head, and expect WordPress to
    	 * provide it for us.
    	 */
    	add_theme_support( 'title-tag' );
    
    	/*
    	 * Enable support for Post Thumbnails on posts and pages.
    	 *
    	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
    	 */
    	add_theme_support( 'post-thumbnails' );
    
    	// This theme uses wp_nav_menu() in one location.
    	register_nav_menus( array(
    		'menu-1' => esc_html__( 'Primary', 'redy' ),
    	) );
    
    	/*
    	 * Switch default core markup for search form, comment form, and comments
    	 * to output valid HTML5.
    	 */
    	add_theme_support( 'html5', array(
    		'search-form',
    		'comment-form',
    		'comment-list',
    		'gallery',
    		'caption',
    	) );
    
    	// Set up the WordPress core custom background feature.
    	add_theme_support( 'custom-background', apply_filters( 'redy_custom_background_args', array(
    		'default-color' => 'ffffff',
    		'default-image' => '',
    	) ) );
    
    	// Add theme support for selective refresh for widgets.
    	add_theme_support( 'customize-selective-refresh-widgets' );
    }
    endif;
    add_action( 'after_setup_theme', 'redy_setup' );
    
    /**
     * Set the content width in pixels, based on the theme's design and stylesheet.
     *
     * Priority 0 to make it available to lower priority callbacks.
     *
     * @global int $content_width
     */
    function redy_content_width() {
    	$GLOBALS['content_width'] = apply_filters( 'redy_content_width', 640 );
    }
    add_action( 'after_setup_theme', 'redy_content_width', 0 );
    
    /**
     * Register widget area.
     *
     * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
     */
    function redy_widgets_init() {
    	register_sidebar( array(
    		'name'          => esc_html__( 'Sidebar', 'redy' ),
    		'id'            => 'sidebar-1',
    		'description'   => esc_html__( 'Add widgets here.', 'redy' ),
    		'before_widget' => '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</section>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'redy_widgets_init' );
    
    /**
     * Enqueue scripts and styles.
     */
    function redy_scripts() {
    	wp_enqueue_style( 'redy-style', get_stylesheet_uri() );
    
    	wp_enqueue_script( 'redy-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
    
    	wp_enqueue_script( 'redy-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
    
    	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    		wp_enqueue_script( 'comment-reply' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'redy_scripts' );
    
    /**
     * Implement the Custom Header feature.
     */
    require get_template_directory() . '/inc/custom-header.php';
    
    /**
     * Custom template tags for this theme.
     */
    require get_template_directory() . '/inc/template-tags.php';
    
    /**
     * Custom functions that act independently of the theme templates.
     */
    require get_template_directory() . '/inc/extras.php';
    
    /**
     * Customizer additions.
     */
    require get_template_directory() . '/inc/customizer.php';
    
    /**
     * Load Jetpack compatibility file.
     */
    require get_template_directory() . '/inc/jetpack.php';
    
    /**
     * Featured Images Settings
     */
    
    set_post_thumbnail_size( 800, 600, array( 'center', 'center')  ); // 800 pixels wide by 600 pixels tall, crop from the center
    
    /**
     * Registers an editor stylesheet for the theme.
     */
    function wpdocs_theme_add_editor_styles() {
        add_editor_style( 'editor-style.css' );
    }
    add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' );
    
    /**
     * Initialize the update checker.
     * Theme Update Checker Library 1.2
     * http://w-shadow.com/
     */
    require 'theme-updates/theme-update-checker.php';
    $example_update_checker = new ThemeUpdateChecker(
    	'redy',                                    //Theme folder name, AKA "slug". 
    	'http://jumpthemes.com/download/info.json' //URL of the metadata file.
    );
    
    /**
    * Footer
    */
    add_action( 'customize_register', 'dco_customize_register' );
    
    function dco_customize_register($wp_customize) {
        //FOOTER
        $wp_customize->add_section('footer', array(
            'title' => 'Подвал',
            'priority' => 1,
        ));
    
        //footer text
        $setting_name = 'footer_text';
        $wp_customize->add_setting($setting_name, array(
            'default' => '',
            'sanitize_callback' => 'sanitize_textarea_field',
            'transport' => 'postMessage'
        ));
    
        $wp_customize->add_control($setting_name, array(
            'section' => 'footer',
            'type' => 'textarea',
            'label' => 'Текст в подвале',
        ));
    
        $wp_customize->selective_refresh->add_partial($setting_name, array(
            'selector' => '.footer-desc',
            'render_callback' => function() use ($setting_name) {
                return nl2br(get_theme_mod($setting_name));
            }
        ));
    }
    
    ?>


    Log
    jumpthemes.com [Wed Mar 22 09:17:54 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy
    jumpthemes.com [Wed Mar 22 09:18:30 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy
    jumpthemes.com [Wed Mar 22 09:30:04 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy
    jumpthemes.com [Wed Mar 22 09:30:33 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy
    jumpthemes.com [Wed Mar 22 09:30:39 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/redy-wordpress-theme/
    jumpthemes.com [Wed Mar 22 12:51:33 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy
    jumpthemes.com [Wed Mar 22 12:54:17 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 200, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy&scrollto=3222
    jumpthemes.com [Wed Mar 22 12:55:33 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy&scrollto=3222
    jumpthemes.com [Wed Mar 22 13:10:03 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected '<' in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 171, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy
    jumpthemes.com [Wed Mar 22 13:12:30 2017] [error] [client 2.94.214.26] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home/r/revinorg/jumpthemes/public_html/wp/wp-content/themes/redy/functions.php on line 198, referer: https://jumpthemes.com/wp/wp-admin/theme-editor.php?file=functions.php&theme=redy&scrollto=3258
  • Как сделать настройку футера в WordPress теме через кастомайзер?

    andre_revin
    @andre_revin Автор вопроса
    Это мой function.php
    Что с ним не так или как правильно вставить код?

    <?php
    /**
    * Redy functions and definitions
    *
    * @link https://developer.wordpress.org/themes/basics/them...
    *
    * @package Redy
    */

    if ( ! function_exists( 'redy_setup' ) ) :
    /**
    * Sets up theme defaults and registers support for various WordPress features.
    *
    * Note that this function is hooked into the after_setup_theme hook, which
    * runs before the init hook. The init hook is too late for some features, such
    * as indicating support for post thumbnails.
    */
    function redy_setup() {
    /*
    * Make theme available for translation.
    * Translations can be filed in the /languages/ directory.
    * If you're building a theme based on Redy, use a find and replace
    * to change 'redy' to the name of your theme in all the template files.
    */
    load_theme_textdomain( 'redy', get_template_directory() . '/languages' );

    // Add default posts and comments RSS feed links to head.
    add_theme_support( 'automatic-feed-links' );

    /*
    * Let WordPress manage the document title.
    * By adding theme support, we declare that this theme does not use a
    * hard-coded tag in the document head, and expect WordPress to
    * provide it for us.
    */
    add_theme_support( 'title-tag' );

    /*
    * Enable support for Post Thumbnails on posts and pages.
    *
    * @link https://developer.wordpress.org/themes/functionali...
    */
    add_theme_support( 'post-thumbnails' );

    // This theme uses wp_nav_menu() in one location.
    register_nav_menus( array(
    'menu-1' => esc_html__( 'Primary', 'redy' ),
    ) );

    /*
    * Switch default core markup for search form, comment form, and comments
    * to output valid HTML5.
    */
    add_theme_support( 'html5', array(
    'search-form',
    'comment-form',
    'comment-list',
    'gallery',
    'caption',
    ) );

    // Set up the WordPress core custom background feature.
    add_theme_support( 'custom-background', apply_filters( 'redy_custom_background_args', array(
    'default-color' => 'ffffff',
    'default-image' => '',
    ) ) );

    // Add theme support for selective refresh for widgets.
    add_theme_support( 'customize-selective-refresh-widgets' );
    }
    endif;
    add_action( 'after_setup_theme', 'redy_setup' );

    /**
    * Set the content width in pixels, based on the theme's design and stylesheet.
    *
    * Priority 0 to make it available to lower priority callbacks.
    *
    * @global int $content_width
    */
    function redy_content_width() {
    $GLOBALS['content_width'] = apply_filters( 'redy_content_width', 640 );
    }
    add_action( 'after_setup_theme', 'redy_content_width', 0 );

    /**
    * Register widget area.
    *
    * @link https://developer.wordpress.org/themes/functionali...
    */
    function redy_widgets_init() {
    register_sidebar( array(
    'name' => esc_html__( 'Sidebar', 'redy' ),
    'id' => 'sidebar-1',
    'description' => esc_html__( 'Add widgets here.', 'redy' ),
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ) );
    }
    add_action( 'widgets_init', 'redy_widgets_init' );

    /**
    * Enqueue scripts and styles.
    */
    function redy_scripts() {
    wp_enqueue_style( 'redy-style', get_stylesheet_uri() );

    wp_enqueue_script( 'redy-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );

    wp_enqueue_script( 'redy-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    wp_enqueue_script( 'comment-reply' );
    }
    }
    add_action( 'wp_enqueue_scripts', 'redy_scripts' );

    /**
    * Implement the Custom Header feature.
    */
    require get_template_directory() . '/inc/custom-header.php';

    /**
    * Custom template tags for this theme.
    */
    require get_template_directory() . '/inc/template-tags.php';

    /**
    * Custom functions that act independently of the theme templates.
    */
    require get_template_directory() . '/inc/extras.php';

    /**
    * Customizer additions.
    */
    require get_template_directory() . '/inc/customizer.php';

    /**
    * Load Jetpack compatibility file.
    */
    require get_template_directory() . '/inc/jetpack.php';

    /**
    * Featured Images Settings
    */

    set_post_thumbnail_size( 800, 600, array( 'center', 'center') ); // 800 pixels wide by 600 pixels tall, crop from the center

    /**
    * Registers an editor stylesheet for the theme.
    */
    function wpdocs_theme_add_editor_styles() {
    add_editor_style( 'editor-style.css' );
    }
    add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' );

    /**
    * Initialize the update checker.
    * Theme Update Checker Library 1.2
    * w-shadow.com
    */
    require 'theme-updates/theme-update-checker.php';
    $example_update_checker = new ThemeUpdateChecker(
    'redy', //Theme folder name, AKA "slug".
    'jumpthemes.com/download/info.json' //URL of the metadata file.
    );

    ?>
  • Как сделать настройку футера в WordPress теме через кастомайзер?

    andre_revin
    @andre_revin Автор вопроса
    1. Да но не уверен
    2. Последняя версия
  • Как сделать настройку футера в WordPress теме через кастомайзер?

    andre_revin
    @andre_revin Автор вопроса
    Денис! Спасибо за ответ, похоже это то, что мне нужно, но к сожалению не работает. Я скопировал в function.php код и после сайт становится не доступен — белый экран. Что я делаю не так?