Home Forums Pro Themes Education Hub Pro How to customize Search button TEXTS

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #57730
    Makoto T
    Participant

    Hi,

    I would like to customize the Search Button TEXTS “Search” on the Education Hub Pro template.

    I know that the other texts on ‘Search Placeholder’ from Theme Options – Search Options. But I cannot find out the button TEXTS “Search” on the WP admin dashboard.

    Could you please advise me about this issue?

    Thank you for your kind quick reply.

    Regards,
    – Mac

    #57736
    wensolutions
    Keymaster

    Hello @makoto,

    The option to directly modify the search button text in the search form in the Admin Dashboard is not available in the theme.

    However, you can edit the text by creating a child theme to modify the contents for search section.

    For reference on creating child theme, you can see the link here :

    https://codex.wordpress.org/Child_Themes

    You can also automate the task by using child theme generator plugin.

    After Creating and activating the child theme, paste in the following code in your child theme’s functions.php file :

    	/**
    	 * Customize search form.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @return string The search form HTML output.
    	 */
    	function education_hub_customize_search_form() {
    
    		$search_placeholder = education_hub_get_option( 'search_placeholder' );
    		$form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
    	      <label>
    	        <span class="screen-reader-text">' . _x( 'Search for:', 'label', 'education-hub' ) . '</span>
    	        <input type="search" class="search-field" placeholder="' . esc_attr( $search_placeholder ) . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x( 'Search for:', 'label', 'education-hub' ) . '" />
    	      </label>
    	      <input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button', 'education-hub' ) . '" />
    	    </form>';
    
    		return $form;
    
    	}

    You can change the “Search” text before"</form>" tag to your desired text.

    Hope this Helps,

    Best Regards !!

    #58022
    Makoto T
    Participant

    Hi,

    Thank you for your advice.

    I have to say that this does not work at this time. As your advice, I did paste this code on the file of Child Theme as below:

    —–

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    }

    function education_hub_check_slider_status( $input ){

    global $post, $wp_query;

    // Slider status
    $featured_slider_status = education_hub_get_option( ‘featured_slider_status’ );

    // Get Page ID outside Loop
    $page_id = $wp_query->get_queried_object_id();

    // Front page displays in Reading Settings
    $page_on_front = get_option( ‘page_on_front’ ) ;
    $page_for_posts = get_option( ‘page_for_posts’ );

    if ( ‘entire-site’ == $featured_slider_status || ( ( is_front_page()) && ‘home-page’ === $featured_slider_status ) ){

    $input = true;
    }
    else{
    $input = false;
    }
    return $input;

    }

    /**
    * Customize search form.
    *
    * @since 1.0.0
    *
    * @return string The search form HTML output.
    */
    function education_hub_customize_search_form() {

    $search_placeholder = education_hub_get_option( 'search_placeholder' );
    $form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
    <label>
    <span class="screen-reader-text">' . _x( 'Search for:', 'label', 'education-hub' ) . '</span>
    <input type="search" class="search-field" placeholder="' . esc_attr( $search_placeholder ) . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x( 'Search for:', 'label', 'education-hub' ) . '" />
    </label>
    <input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button', 'education-hub' ) . '" />
    </form>';

    return $form;

    }

    ?>

    —–

    Is there anything I need to amend on this functions.php in the child theme?

    I am looking forward to hearing fro you soon.

    Best wishes,
    – Makoto

    #58087
    Makoto T
    Participant

    Hi,

    Now I could solve this issue by my self. In stead of last advice, I did need to paste this below code on functions.php file in the child theme and change the Search text. Thank you for your help anyway.
    >>>>>>>>>>>>>>>>>

    function education_hub_customize_search_form() {

    $search_placeholder = education_hub_get_option( ‘search_placeholder’ );
    $form = ‘<form role=”search” method=”get” class=”search-form” action=”‘ . esc_url( home_url( ‘/’ ) ) . ‘”>
    <label>
    <span class=”screen-reader-text”>’ . _x( ‘Search for:’, ‘label’, ‘education-hub’ ) . ‘</span>
    <input type=”search” class=”search-field” placeholder=”‘ . esc_attr( $search_placeholder ) . ‘” value=”‘ . get_search_query() . ‘” name=”s” title=”‘ . esc_attr_x( ‘Search for:’, ‘label’, ‘education-hub’ ) . ‘” />
    </label>
    <input type=”submit” class=”search-submit” value=”‘ . esc_attr_x( ‘Search’, ‘submit button’, ‘education-hub’ ) . ‘” />
    </form>’;

    return $form;

    }

    >>>>>>>>>>>>>>>>>
    Cheers,
    – Makoto

    #58105
    wensolutions
    Keymaster

    Hello @makoto,

    Yes to change text you should paste the code in child theme changing search text .

    Also we are glad that you figured out the issue by yourself .

    Further more if you have any issue / confusion please let us know .

    Best Regards!!

    Have a good day .

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.