• Hi there!

    By looking into your website, I’ve found a useful document that talks about performing a change from the default string to a different one => https://wpastra.com/docs/astra_default_strings/

    However, I didn’t figure out which is the file I have to edit in order to add the function described in the document. Could you please help me about that?

    Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @impsubi,

    This filter needs to be added in the functions.php file in your child theme.

    If you are not using a child theme, you can generate it from here – https://wpastra.com/child-theme-generator/

    Thread Starter impsubi

    (@impsubi)

    Hi Nikhil!

    Firstly, thanks for your answer. I’ve been trying to add the code into my functions.php file from my child theme. However, I didn’t manage to change any of the default strings, unfortunately.

    This is what I’ve added insisde the functions.php:

    <?php

    function default_strings_callback( $strings ) {
    // Search nothing found string
    $strings[‘string-search-nothing-found’] = __( ‘ enc.’, ‘astra’ );
    // Search input box placeholder
    $strings[‘string-search-input-placeholder’] = __( ‘bu …’, ‘astra’ );
    return $strings;
    }
    add_filter( ‘astra_default_strings’, ‘default_strings_callback’, 10 );

    /**
    * Astra Child Theme functions and definitions
    *
    * @link https://developer.wordpress.org/themes/basics/theme-functions/
    *
    * @package Astra Child
    * @since 1.0.0
    */

    /**
    * Define Constants
    */
    define( ‘ASTRA_CHILD_THEME_VERSION’, ‘1.0.0’ );

    /**
    * Enqueue styles
    */
    function child_enqueue_styles() {

    wp_enqueue_style( ‘astra-child-theme-css’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘astra-theme-css’), ASTRA_CHILD_THEME_VERSION, ‘all’ );

    }

    add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_styles’, 15 );

    Would you mind to give me a hand on that please?

    Thanks!

    Hello @impsubi,

    Just for testing, Can you add this at the end of your functions.php This should update the string on search page

    function your_prefix_default_strings_callback( $strings ) {
    	$strings['string-search-nothing-found-message']	= __( 'custom search page message', 'astra' );
    
    	return $strings;
    }
    add_filter( 'astra_default_strings', 'your_prefix_default_strings_callback', 10 );

    Let me know if this works

    Thread Starter impsubi

    (@impsubi)

    Hi Nikhil,

    Thanks a lot for your answer, I’ve been giving a try about your troubleshooting and it’s working perfectly fine! =)

    This is what I have actually:

    function your_prefix_default_strings_callback( $strings ) {

    $strings[‘string-search-nothing-found-message’] = __( ‘my custom search page message’, ‘astra’ );
    $strings[‘string-search-input-placeholder’] = __( ‘Start Typing…’, ‘astra’ );

    return $strings;
    }
    add_filter( ‘astra_default_strings’, ‘your_prefix_default_strings_callback’, 10 );

    The line regarding nothing found message was changed successfully, however I’m still unable to change the message into the placeholder from the search input box, even though I had added the line inside the code.

    I’m sorry to bother you about that, but would you mind to look further into it.

    Thanks again!

    Theme Author Brainstorm Force

    (@brainstormforce)

    Hi @impsubi: Could you please open up a support ticket from our website? We don’t track forums over here and for the faster response, I would encourage you to open up a ticket from our website.

    Thanks 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to change default strings’ is closed to new replies.