Вставить свой текст в блок комментрии
-
Здравствуйте.
Встала задача заменить стандартный текст «Для отправки комментария вам необходимо авторизоваться.» своим.
Поискав в файлах темы я ничего подобного не нашел.
Файлов темы только три (тема Davis):
Davis: Основной шаблон (index.php)
<!DOCTYPE html> <html class="no-js" <?php language_attributes(); ?>> <head> <meta http-equiv="content-type" content="<?php bloginfo( 'html_type' ); ?>" charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" > <link rel="profile" href="http://gmpg.org/xfn/11"> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <?php if ( function_exists( 'wp_body_open' ) ) { wp_body_open(); } ?> <a class="skip-link screen-reader-text" href="#site-content"><?php _e( 'Skip to the content', 'davis' ); ?></a> <a class="skip-link screen-reader-text" href="#menu-menu"><?php _e( 'Skip to the main menu', 'davis' ); ?></a> <header class="site-header" role="banner"> <button type="button" class="toggle-menu" onclick="document.querySelector('body').classList.toggle('show-menu')"><?php _e( 'Menu', 'davis' ); ?></button> <?php if ( has_nav_menu( 'primary-menu' ) ) : ?> <nav role="navigation"> <?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?> </nav> <?php endif; ?> <?php $site_title_elem = is_front_page() ? 'h1' : 'div'; ?> <<?php echo $site_title_elem; ?> class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></<?php echo $site_title_elem; ?>> <?php if ( get_bloginfo( 'description' ) ) : ?> <p class="site-description"><?php bloginfo( 'description' ); ?></p> <?php endif; ?> </header><!-- header --> <main class="wrapper" id="site-content" role="main"> <?php if ( is_archive() || is_search() ) : if ( is_search() ) { global $wp_query; // Translators: %s = The search query $archive_title = sprintf( _x( 'Search Results: “%s”', '%s = The search query', 'davis' ), get_search_query() ); $archive_description = sprintf( _nx( '%s result was found.', '%s results were found.', $wp_query->found_posts, '%s = The search query', 'davis' ), $wp_query->found_posts ); } else { $archive_title = get_the_archive_title(); $archive_description = get_the_archive_description(); } ?> <header class="archive-header"> <?php if ( $archive_title ) : ?> <h1 class="archive-title"><?php echo $archive_title; ?></h1> <?php endif; ?> <?php if ( $archive_description ) : ?> <div class="archive-description"><?php echo $archive_description; ?></div> <?php endif; ?> </header> <?php endif; ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div <?php post_class( 'post' ); ?>> <?php if ( ! get_post_format() == 'aside' ) : $post_title_elem = is_single() ? 'h1' : 'h2'; ?> <<?php echo $post_title_elem; ?> class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></<?php echo $post_title_elem; ?>> <?php endif; ?> <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?> <a href="<?php the_permalink(); ?>" class="featured-image"> <?php the_post_thumbnail( 'post-image' ); ?> </a> <?php endif; ?> <div class="content"> <?php the_content(); edit_post_link(); ?> </div><!-- .content --> <?php if ( is_singular() ) wp_link_pages(); $post_type = get_post_type(); if ( $post_type == 'post' ) : ?> <div class="meta"> <p> <a href="<?php the_permalink(); ?>"><?php the_time( get_option( 'date_format' ) ); ?></a> <?php if ( comments_open() && ! post_password_required() ) : ?> <span class="sep"></span><?php comments_popup_link( __( 'Добавить отзыв', 'davis' ), __( '1 Отзыв', 'davis' ), '% ' . __( 'Отзывы', 'davis' ), '', __( 'Comments off', 'davis' ) ); ?> <?php endif; ?> <?php if ( is_sticky() ) : ?> <span class="sep"></span><?php _e( 'Sticky', 'davis' ); ?> <?php endif ?> </p> <?php if ( is_singular( 'post' ) ) : ?> <p><?php the_tags( ' #', ' #', ' ' ); ?></p> <?php endif; ?> </div><!-- .meta --> <?php endif; if ( ( $post_type == 'post' || comments_open() || get_comments_number() ) && ! post_password_required() ) { comments_template(); } ?> </div><!-- .post --> <?php endwhile; else : ?> <div class="post"> <p><?php _e( 'Sorry, the page you requested cannot be found.', 'davis' ); ?></p> </div><!-- .post --> <?php endif; if ( ! is_singular() && ( get_previous_posts_link() || get_next_posts_link() ) ) : ?> <div class="pagination"> <?php previous_posts_link( '← ' . __( 'Newer posts', 'davis' ) ); ?> <?php next_posts_link( __( 'Older posts', 'davis') . ' →' ); ?> </div><!-- .pagination --> <?php endif; ?> <div class="post"> <h4 class="comment-reply-title">Популярные записи блога</h4> <?php if (function_exists('wpp_get_mostpopular')) wpp_get_mostpopular("range=all&order_by=views&stats_comments=1"); ?> </div> <!-- .post --> }); </footer><!-- footer --> </main><!-- .wrapper --> <?php wp_footer(); ?> </body> </html>
И _Функции темы (functions.php)
<?php /* THEME SETUP ------------------------------------------------ */ if ( ! function_exists( 'davis_setup' ) ) : function davis_setup() { // Automatic feed add_theme_support( 'automatic-feed-links' ); // Set content-width global $content_width; if ( ! isset( $content_width ) ) $content_width = 620; // Post thumbnails add_theme_support( 'post-thumbnails' ); add_image_size( 'post-image', 620, 9999 ); // Title tag add_theme_support( 'title-tag' ); // Post formats add_theme_support( 'post-formats', array( 'aside' ) ); // Add nav menu register_nav_menu( 'primary-menu', __( 'Primary Menu', 'davis' ) ); // Make the theme translation ready load_theme_textdomain( 'davis', get_template_directory() . '/languages' ); $locale_file = get_template_directory() . "/languages/" . get_locale(); if ( is_readable( $locale_file ) ) { require_once( $locale_file ); } } add_action( 'after_setup_theme', 'davis_setup' ); endif; /* ENQUEUE STYLES ------------------------------------------------ */ if ( ! function_exists( 'davis_load_style' ) ) : function davis_load_style() { $theme_version = wp_get_theme( 'davis' )->get( 'Version' ); if ( ! is_admin() ) { wp_register_style( 'davis_fonts', '//fonts.googleapis.com/css?family=PT+Serif:400,700,400italic,700italic' ); wp_enqueue_style( 'davis_style', get_stylesheet_uri(), array( 'davis_fonts' ) ); } } add_action( 'wp_enqueue_scripts', 'davis_load_style' ); endif; /* ENQUEUE COMMENT-REPLY.JS ------------------------------------------------ */ if ( ! function_exists( 'davis_load_scripts' ) ) : function davis_load_scripts() { $theme_version = wp_get_theme( 'davis' )->get( 'Version' ); wp_enqueue_script( 'davis_construct', get_template_directory_uri() . '/assets/js/construct.js', array( 'jquery' ), $theme_version, true ); if ( ( ! is_admin() ) && is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'davis_load_scripts' ); endif; /* BODY CLASSES ------------------------------------------------ */ if ( ! function_exists( 'davis_body_classes' ) ) : function davis_body_classes( $classes ) { // Check whether we want it darker if ( get_theme_mod( 'davis_dark_mode' ) ) { $classes[] = 'dark-mode'; } return $classes; } add_action( 'body_class', 'davis_body_classes' ); endif; /* CUSTOMIZER SETTINGS ------------------------------------------------ */ class davis_customize { public static function davis_register ( $wp_customize ) { // Dark Mode $wp_customize->add_setting( 'davis_dark_mode', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'davis_sanitize_checkbox', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'davis_dark_mode', array( 'type' => 'checkbox', 'section' => 'colors', // Default WP section added by background_color 'label' => __( 'Dark Mode', 'davis' ), 'description' => __( 'Displays the site with white text and black background. If Background Color is set, only the text color will change.', 'davis' ), ) ); // Make built-in controls use live JS preview $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; // SANITATION // Sanitize boolean for checkbox function davis_sanitize_checkbox( $checked ) { return ( ( isset( $checked ) && true == $checked ) ? true : false ); } } // Initiate the live preview JS public static function davis_live_preview() { wp_enqueue_script( 'davis-themecustomizer', get_template_directory_uri() . '/assets/js/theme-customizer.js', array( 'jquery', 'customize-preview' ), '', true ); } } // Setup the Theme Customizer settings and controls add_action( 'customize_register', array( 'davis_customize', 'davis_register' ) ); // Enqueue live preview javascript in Theme Customizer admin screen add_action( 'customize_preview_init', array( 'davis_customize' , 'davis_live_preview' ) ); /* --------------------------------------------------------------------------------------------- SPECIFY GUTENBERG SUPPORT ------------------------------------------------------------------------------------------------ */ if ( ! function_exists( 'davis_add_gutenberg_features' ) ) : function davis_add_gutenberg_features() { /* Gutenberg Palette --------------------------------------- */ add_theme_support( 'editor-color-palette', array( array( 'name' => _x( 'Black', 'Name of the black color in the Gutenberg palette', 'davis' ), 'slug' => 'black', 'color' => '#000', ), array( 'name' => _x( 'White', 'Name of the white color in the Gutenberg palette', 'davis' ), 'slug' => 'white', 'color' => '#fff', ), ) ); } add_action( 'after_setup_theme', 'davis_add_gutenberg_features' ); endif; //Замена строк и кнопок комментирования start add_filter( 'comment_form_defaults', 'change_comment_form_defaults' ); function change_comment_form_defaults( $args ) { $args['fields']['author'] = str_replace( __( 'Name' ), 'Введите, пожалуйста, своё ИМЯ и ФАМИЛИЮ', $args['fields']['author'] ); $args['fields']['email'] = str_replace( __( 'Email' ), 'Укажите адрес электронной почты (email)', $args['fields']['email'] ); $args['comment_field'] = str_replace( _x( 'Comment', 'noun' ), '<p>Оставить комментарий может любой желающий, для этого достаточно указать свое ИМЯ и ФАМИЛИЮ, и обязательно прочитать <u><a href="http://hudozhnik-restavrator.ru/voprosy-i-otvety-po-sajtu">правила комментирования</a></u>, в противной случае ваш отзыв опубликован не будет.<br> Однако настоятельно рекомендую <u><a href="http://hudozhnik-restavrator.ru/wp-login.php">зарегистрироваться в блоге</a></u>. Зарегистрированным читателям пользоваться сайтом гораздо удобнее.</p>', $args['comment_field'] ); $args['comment_notes_before'] = sprintf( '<p class="comment-notes">%s</p>', 'Прежде чем оставить свой комментарий, обязательно прочитайте <font color="red"><a href="http://hudozhnik-restavrator.ru/voprosy-i-otvety-po-sajtu">правила комментирования</a></font>, в противном случае он может быть не опубликован!' ); $args['title_reply'] = 'Оставить комментарий'; $args['label_submit'] = 'Отправить комментарий'; return $args; } ?>
И
<?php if ( $comments ) : ?> <div class="comments"> <h3 class="comment-reply-title"><?php _e( 'Comments', 'davis' ) ?></h3> <?php wp_list_comments( array( 'style' => 'div' ) ); ?> <?php if ( paginate_comments_links( array( 'echo' => false ) ) ) : ?> <div class="pagination"><?php paginate_comments_links(); ?></div> <?php endif; ?> </div><!-- .comments --> <?php endif; if ( comments_open() || pings_open() ) : comment_form( array( 'comment_notes_before' => '', 'comment_notes_after' => '' ) ); else : ?> <div class="comments" id="respond"> <p class="comments-closed"><?php _e( 'Comments are closed.', 'davis' ); ?></p> </div><!-- #respond --> <?php endif; ?>
Подскажите, куда и что нужно вставить, чтобы решить мою проблему.
Страница, с которой нужна помощь: [войдите, чтобы увидеть ссылку]
- Тема «Вставить свой текст в блок комментрии» закрыта для новых ответов.