• Hi, i’ve tried searching for answers but nothing seems to help me. My search bars never produce any results – ever. Could anyone please take a look at my search.php and tell me the problem – thanks in advance:

    <?php get_header(); ?>
    <div class="main">
    	<?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<!-- Start: Post -->
    			<div <?php post_class(); ?>>
    				<h2><a>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> <?php edit_post_link(__('Edit this entry', 'black_with_orange'), '', ''); ?></h2>
    				<p class="post-meta"><span class="date"><?php the_time( get_option( 'date_format' ) ) ?></span> <span class="author"><?php the_author() ?></span> <span class="cats"><?php the_category(", "); ?></span><?php if ( comments_open() ) : ?>, <span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span> <?php endif; ?></p>
    				<?php the_post_thumbnail(); ?>
    				<?php the_content(); ?>
    				<p class="more"><a>"><?php _e( ' ', 'black_with_orange' ); ?></a></p>
    				<?php if(has_tag()): ?><p class="tags"><span><?php the_tags(""); ?></span></p><?php endif; ?>
    			</div>
    			<!-- End: Post -->
    		<?php endwhile; ?>
    
    		<p class="pagination">
    			<span class="prev"><?php next_posts_link(__('Previous Posts', 'black_with_orange')) ?></span>
    			<span class="next"><?php previous_posts_link(__('Next posts', 'black_with_orange')) ?></span>
    		</p>
    	<?php else : ?>
    		<h1><?php _e( 'No posts found. Try a different search?', 'black_with_orange' ); ?></h1>
    		<?php get_search_form(); ?>
    	<?php endif; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use a pastebin. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter alexbudfox

    (@alexbudfox)

    the url is http://www.tensecondscoop.com

    thanks

    Maybe I’m missing something here… Where is your search bar? I’m using FF and don’t see anywhere to input a search.

    Also, viewing with FF, you seem to have an issue with where the Google +1 button is showing. Right now, it’s located in the top banner ad.

    why not just call the loop with:

    get_template_part( 'loop', 'search' );

    Edit: add search term to end of this url:
    http://www.tensecondscoop.com/?s=

    Thread Starter alexbudfox

    (@alexbudfox)

    thanks for your replies guys

    thewpcoach: I don’t want to put the search bar back till I’ve fixed the problem. Thanks for letting me know about google+1, i got rid of it.

    shadez: I am not sure where to put that piece of code you gave me. please let me know, thanks

    i meant replace all code from search.php with this:

    <?php get_header(); ?>
    <div class="main">
    <?php if ( have_posts() ) :
    get_template_part( 'loop', 'search' );
    endif; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    but that might not be the problem coz the code is almost the same…

    or replace the contents within <div post_class> with:

    <div <?php post_class(); ?>>
    <h2><?php the_title(); ?></h2>
    </div>

    but again… the text displayed is ‘Apologies….’ and what you have in your code is ‘No post found’…
    check by disabling plugins.. including jetpack…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search bar never finds any posts’ is closed to new replies.