Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • search form in worpress theme

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 338
    Comment on it

    searchform.php is an important template file that is why it is included many a time in the sidebar of many themes and generates the search box form. If this template is not in your theme, you can copy the below code and include it in your theme.

    <form role="search" method="get" id="searchform" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>"> 
        <div> 
            <label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label> 
            <input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" /> 
            <input type="submit" id="searchsubmit" value="<?php echo esc_attr_x( 'Search', 'submit button' ); ?>" /> 
        </div> 
    </form> 
    

    You can also create your own custom search page (searchpage.php). At the top of your searchpage.php, before doing anything else, add this below code to give your Search Page a heading. WordPress will recognize in the Administration Panels. Save the file and upload the file into your theme directory.

    <?php 
    /* 
    Template Name: Search Page 
    */ 
    ?> 
    My Site features articles about 
        <a title="WordPress Articles" href="/category/wordpress/">WordPress</a>, 
        <a title="Web Design Articles" href="/category/web-design/">web page design</a>, 
        <a title="Development Articles" href="/category/website-development/">website development</a>, 
        and <a title="CSS Articles" href="/category/css/">CSS</a>. 
    
    To search my website, please use the form below. 
    <?php get_search_form(); ?> 
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: