Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new to wordpress and need to modify the default search functionality. What file do I have to look for or provide me with some tutorials..

Any help would be much appreciated

share|improve this question
add comment

2 Answers 2

Modify the searchform.php, or create one in a child theme (recommended), and you should be able to modify the form all you want.

The default HTML is in /wp-includes/general-template.php, to which I have already linked, but don't edit that. It is a Core file. Copy the markup into your searchform.php if you need a place to start.

Please refer this link to modify search function detail.

Also refer this link for adding custom post type in search.

share|improve this answer
1  
Please use a little more descriptive anchors than "this link", it makes answer more readable and easier to know where link leads to. –  Rarst Nov 21 '13 at 11:00
add comment

Example - http://codex.wordpress.org/Function_Reference/register_post_type#Example

(ensure you have these parameters true :

'publicly_queryable' => true, 'query_var' => true,

then you might need to have this function to include search code in functions.php for custom post types:

add_action('pre_get_posts','search_filterr');
function search_filterr($query) 
    {
    if ( !is_admin() && $query->is_main_query() ) 
        {
            global $cts,$lang; $arrs=array(); foreach($cts['post_Typess'] as $befefeb) {$arrs[]=$befefeb;}
            if ( $query->is_search ) 
                {
                $arrs[]='post';
                $arrs[]='page';
                $query->set('post_type',  $arrs );

                    //include only specific categories
                    //global $sxvaa,$lang;
                    //$query->set('cat', '' );
                }

            else
                {
                $arrs[]='post';
                $arrs[]='page';
                $query->set('post_type', $arrs  );
                }
        return $query;
        }
    }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.