• Phillip Dews

    (@phillipdewsblogger)


    Hi All,
    I have a small problem with a searchform on a custom theme I have built! The website in question is https://www.commsaxis.com/ for some reason the searchform is not showing whatsoever on all browsers and after clearing cache multiple times!

    In functions.php i have added: add_theme_support( 'html5', array( 'search-form' ) );

    My searchform.php is:

    <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
    	<label>
    		<span class="screen-reader-text">Search for:</span>
    		<input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:" />
    	</label>
    	<input type="submit" class="search-submit" value="Search" />
    </form>

    in my header.php wrapped in a div is: <?php get_search_form( $echo ); ?>

    and finally in search.php again wrapped in a div is:

    <?php
        if (have_posts()) : ?>
            <h2>Search results for: <?php the_search_query(); ?></h2>
            <?php
            while (have_posts()) : the_post();
              get_template_part(‘content’, get_post_format());
            endwhile;
            else :
            echo ‘<p>No content found</p>’;
        endif;
    ?>

    Have I missed a trick somewhere at all as im sure this is correct having used this multiple times before.
    Many thanks. Phillip

  • The topic ‘searchform not showing!’ is closed to new replies.