View file root/inc/thumbnails.php

File size: 2.42Kb
<?php
/**
 * ****************************************************************************
 *
 *   НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ
 *
 *   ВНИМАНИЕ!!!!!!!
 *
 *   НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ
 *   ПРИ ОБНОВЛЕНИИ ТЕМЫ - ВЫ ПОТЕРЯЕТЕ ВСЕ ВАШИ ИЗМЕНЕНИЯ
 *   ИСПОЛЬЗУЙТЕ ДОЧЕРНЮЮ ТЕМУ ИЛИ НАСТРОЙКИ ТЕМЫ В АДМИНКЕ
 *
 *   ПОДБРОБНЕЕ:
 *   https://docs.wpshop.ru/child-themes/
 *
 * *****************************************************************************
 *
 * @package Root
 */

function root_add_featured_image_display_settings( $content, $post_id ) {
    $field_text_before  = esc_html__( 'Рекомендуемый размер 770x330', 'root' );
    $content = '<p class="howto">'. $field_text_before . '</p>' . $content;

    return $content;
}
add_filter( 'admin_post_thumbnail_html', 'root_add_featured_image_display_settings', 10, 2 );


function wpshop_core_thumbnails() {

    class Posts_Thumbnails extends Vetteo_Meta_Box {

        public function __construct() {
            $this->set_settings( 'posts_thumb_', 'post', __( 'Thumbnail settings', 'root' ), 'side' );

            parent::__construct();
        }

        public function render_fields() {
            $field_text = '<p class="howto">' . sprintf( esc_html__( 'A thumbnail will be displayed on the page for the full width of the site. Recommended size %s', THEME_TEXTDOMAIN ), '1140x400' ) . '</p>';
            $this->field_checkbox( 'big_thumbnail_image',      '', __( 'Big thumbnail', 'root' ) . $field_text );
        }

    }

    new Posts_Thumbnails;



    class Pages_Thumbnails extends Vetteo_Meta_Box {

        public function __construct() {

            $this->set_settings( 'pages_thumb_', 'page', __( 'Thumbnail settings', 'root' ), 'side' );

            parent::__construct();
        }

        public function render_fields() {
            $field_text = '<p class="howto">' . sprintf( esc_html__( 'A thumbnail will be displayed on the page for the full width of the site. Recommended size %s', THEME_TEXTDOMAIN ), '1140x400' ) . '</p>';
            $this->field_checkbox( 'big_thumbnail_image',      '', __( 'Big thumbnail', 'root' ) . $field_text );
        }

    }

    new Pages_Thumbnails;

}
add_action( 'after_setup_theme', 'wpshop_core_thumbnails' );