ThemeShaper Forums » Thematic

how to change thematic_search_form() output in child theme

(3 posts)
  • Started 9 years ago by patpro
  • Latest reply from patpro
  • This topic is resolved
  1. I'm currently in the process of updating my old thematic files to the latest release.
    I've made some customizations in the old files that I would like to transpose to the new child theme system.

    I've modified the searchform look & feel but I can't find where in my child theme I'm supposed to put those modifications.

    I've created this function in functions.php, as a replacement for the thematic_search_form() function:

    function patpro_search_form() {
    	$search_form = "\n" . "\t";
    	$search_form .= '<form id="searchform" method="get" action="' . get_bloginfo('home') .'"><div>';
    	$search_form .= "\n" . "\t" . "\t". "\t";
    	$search_form .= '<input type="search" autosave="blog.patpro.net" placeholder="Recherche" results="10" name="s" id="s" size="20" value="' . wp_specialchars(stripslashes($_GET['s']), true) .'" size="32" tabindex="1" />';
    	$search_submit = '<input id="searchsubmit" name="searchsubmit" type="submit" value="ok" tabindex="2" />';
    
    	$search_form .= apply_filters('thematic_search_submit', $search_submit);
    
    	$search_form .= "\n" . "\t" . "\t";
    	$search_form .= '</div></form>';
    
    	echo apply_filters('patpro_search_form', $search_form);
    }

    But I still have to invoque patpro_search_form() from the file searchform.php in wp-content/themes/thematic/ directory.

    Any idea ?

    Posted 9 years ago #
  2. Hi,

    without testing your search form for functionality .. it should look like this:

    function patpro_search_form() {
    	$search_form = "\n" . "\t";
    	$search_form .= '<form id="searchform" method="get" action="' . get_bloginfo('home') .'"><div>';
    	$search_form .= "\n" . "\t" . "\t". "\t";
    	$search_form .= '<input type="search" autosave="blog.patpro.net" placeholder="Recherche" results="10" name="s" id="s" size="20" value="' . wp_specialchars(stripslashes($_GET['s']), true) .'" size="32" tabindex="1" />';
    	$search_form .= '<input id="searchsubmit" name="searchsubmit" type="submit" value="ok" tabindex="2" />';
    	$search_form .= "\n" . "\t" . "\t";
    	$search_form .= '</div></form>';
    
    	return $search_form;
    }
    add_filter('thematic_search_form', 'patpro_search_form');

    Chris

    Posted 9 years ago #
  3. That's it! perfect :)
    Thank you very much.

    patpro

    Posted 9 years ago #

RSS feed for this topic

Reply

You must log in to post.