How to Change the Default Astra Strings

How to Change the Default Astra Strings

Description

The astra_default_strings filter allows you to change the default strings printed by Astra.

Usage

// Filter callback function
function example_callback( $strings ) {
# ...
return $strings;
}
add_filter( 'astra_default_strings', 'example_callback', 10 );

Parameters

// 404 Page Strings
$strings['string-404-sub-title'] = __( 'This page doesn't seem to exist.', 'astra' );
$strings['string-404-search-title'] = __( 'It looks like the link pointing here was faulty. May be try searching?', 'astra' );

// Search Page Strings
$strings['string-search-nothing-found'] = __( 'Nothing Found', 'astra' );
$strings['string-search-nothing-found-message'] = __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'astra' );
$strings['string-full-width-search-message'] = __( 'Start typing and press enter to search', 'astra' );
$strings['string-full-width-search-placeholder'] = __( 'Start Typing...', 'astra' );
$strings['string-header-cover-search-placeholder'] = __( 'Start Typing...', 'astra' );
$strings['string-search-input-placeholder'] = __( 'Search ...', 'astra' );

// Comment Template Strings
$strings['string-comment-reply-link'] = __( 'REPLY', 'astra' );
$strings['string-comment-edit-link'] = __( 'EDIT', 'astra' );
$strings['string-comment-awaiting-moderation'] = __( 'Your comment is awaiting moderation.', 'astra' );
$strings['string-comment-title-reply'] = __( 'Leave Comment', 'astra' );
$strings['string-comment-cancel-reply-link'] = __( 'Cancel Reply', 'astra' );
$strings['string-comment-label-submit'] = __( 'Post Comment →', 'astra' );
$strings['string-comment-label-message'] = __( 'Message', 'astra' );
$strings['string-comment-label-name'] = __( 'Name*', 'astra' );
$strings['string-comment-label-email'] = __( 'Email*', 'astra' );
$strings['string-comment-label-website'] = __( 'Website', 'astra' );
$strings['string-comment-closed'] = __( 'Comments are closed.', 'astra' );
$strings['string-comment-navigation-title'] = __( 'Comment navigation', 'astra' );
$strings['string-comment-navigation-next'] = __( 'Newer Comments', 'astra' );
$strings['string-comment-navigation-previous'] = __( 'Older Comments', 'astra' );
$strings['string-comment-one-comment'] = __( 'ONE COMMENT', 'astra' );
$strings['string-comment-multiple-comment'] = __( '%1$s COMMENTS', 'astra' );

// Blog Default Strings
$strings['string-blog-page-links-before'] = __( 'Pages:', 'astra' );
$strings['string-blog-meta-author-by'] = __( 'By ', 'astra' );
$strings['string-blog-meta-leave-a-comment'] = __( 'Leave a comment', 'astra' );
$strings['string-blog-meta-one-comment'] = __( '1 Comment', 'astra' );
$strings['string-blog-meta-multiple-comment'] = __( '% Comments', 'astra' );
$strings['string-blog-navigation-next'] = __('Next Page', 'astra') . ' →';
$strings['string-blog-navigation-previous'] = '← ' . __('Previous Page', 'astra');

// Single Post Default Strings
$strings['string-single-page-links-before'] = __( 'Pages:', 'astra' );
$strings['string-single-navigation-next'] = __('Next Post', 'astra') . ' →';
$strings['string-single-navigation-previous'] = '← ' . __('Previous Post', 'astra');

// Content None
$strings['string-content-nothing-found-message'] = __( 'It seems we can't find what you're looking for. Perhaps searching can help.', 'astra' );

Example

/**
* Update Search Nothing Found String and Search Input Box Placeholder Strings
*
* @param array $strings List of default strings used in theme
* @return array $strings
*/
function default_strings_callback( $strings ) {
// Search nothing found string
$strings['string-search-nothing-found-message'] = __( 'Sorry, There is no Search Result found.', 'astra' );
// Search input box placeholder
$strings['string-search-input-placeholder'] = __( 'Search ...', 'astra' );
return $strings;
}
add_filter( 'astra_default_strings', 'default_strings_callback', 10 );

Check out the doc that explains how to add custom PHP code using the child theme』s functions.php file.

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注