• Hi

    I’m a no code designer and having an issue with a dynamic tag.

    On search result archive, there is a dynamic tag called “Archive title”, it show terms like “Search Results for: (Search_term)”

    What I want it to appear it like just “(Search_term)” without “search results for:”

    I try to add this filter in the Hello Elementor file functions.php but it doesn’t work :

    add_filter( 'gettext', function( $text ) {
        if ( 'Search Results for: %s' === $text ) {
            $text = '%s';
        }
    
        return $text;
    } );

    Anyone have an idea?

    Wordpress 5.9
    WooCommerce 6.2.0
    Elementor Pro 3.6.2
    Hello Elementor 1.2.0

    Thank you for your help

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Ian Sackofwits

    (@plantprogrammer)

    Hi, adminmonsoft, I am another Hello Elementor theme user.

    I see that you were able to resolve the issue; I am posting for people who wish to know what the solution is for the future.

    In the hello-theme/template-parts/search.php file, line 16 –
    <?php esc_html_e( 'Search results for: ', 'hello-elementor' ); ?>

    Indicates the string that should be targeted.

    We can then target the gettext filter via two ways depending on the WordPress version:

    /**
    189	         * Filters text with its translation.
    190	         *
    191	         * @since 2.0.11
    192	         *
    193	         * @param string $translation Translated text.
    194	         * @param string $text        Text to translate.
    195	         * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
    196	         */
    197	        $translation = apply_filters( 'gettext', $translation, $text, $domain );
    198	
    199	        /**
    200	         * Filters text with its translation for a domain.
    201	         *
    202	         * The dynamic portion of the hook name, <code>$domain</code>, refers to the text domain.
    203	         *
    204	         * @since 5.5.0
    205	         *
    206	         * @param string $translation Translated text.
    207	         * @param string $text        Text to translate.
    208	         * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
    209	         */
    210	        $translation = apply_filters( "gettext_{$domain}", $translation, $text, $domain );
Viewing 1 replies (of 1 total)

The topic ‘Search archive title’ is closed to new replies.