Search Redirecting To Homepage

Hi,

I'm utilizing the HTML5Blank Wordpress Theme by Todd Motto for a site I'm currently developing.

I have the deafault search widget added to the sidebar on the blog page. When I try and use the search functionality, it just redirects to the homepage and doesn't perform any type of search.

Anyone have any experience with this in why it may be happening?

http://developer.creativ3group.com/creativ33/blog

1. I have a search.php file in the Theme
2. My permalink structure is /blog/%postname%
3. Here's the link to the Theme if someone needs it: http://html5blank.com/

Any help here would be GREATLY appreciated. I also be happy to provide FTP/WP access if needed if someone wants to look under the hood as I have a few custom functions added.

  • Tyler Orr
    • Site Builder, Child of Zeus

    The search.php and searchform.php was created by the developer.

    Here is the content of each:

    search.php:

    <?php get_header(); ?>
    
    	<!-- Section -->
    	<section>
    
    		<h1><?php echo sprintf( __( '%s Search Results for ', 'html5blank' ), $wp_query->found_posts ); echo get_search_query(); ?></h1>
    
    		<?php get_template_part('loop'); ?>
    
    		<!-- Pagination -->
    		<div class="pagination">
    			<?php html5wp_pagination(); ?>
    		</div>
    		<!-- /Pagination -->
    
    	</section>
    	<!-- /Section -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    searchform.php:

    <!-- Search -->
    <form class="search" method="get" action="<?php echo home_url(); ?>">
    	<input class="search-input" type="text" placeholder="To search, type and hit enter.">
    	<button class="search-submit" type="submit"><?php _e( 'Search', 'html5blank' ); ?></button>
    </form>
    <!-- /Search -->

    I'm assuming there is an error in the searchform.php

  • Ash
    • WordPress Hacker

    Change code from searchform.php to:

    <!-- Search -->
    <form class="search" method="get" action="<?php echo home_url(); ?>">
    	<input class="search-input" type="text" placeholder="To search, type and hit enter." name="s">
    	<button class="search-submit" type="submit"><?php _e( 'Search', 'html5blank' ); ?></button>
    </form>

    Let me know if it works.

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    "name" attribute to use in a form field to pass data from one page to another. In wordpress search textbox uses name="s". So we should name the search field as "s" so that wordpress can use it's search result processing function and show the results.

    Feel free to ask if you have any more question.

    Also, I am marking this thread resolved. But if you need you can re-open this.

    Cheers
    Ash

  • Tyler Orr
    • Site Builder, Child of Zeus

    Also, and this may be a default Wordpress function, but is there a way to just return results that are just posts and not pages or custom post types?

    Does that have something to do with the loop and exchanging it for a different php call in search.php? If that's the case I can remove it and write a different php call - I'm just making sure I'm looking in the right place.

    Thanks for the help!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.