Forums

[resolved] Search bar not working :( (19 posts)

  1. viltnieks
    Member
    Posted 2 years ago #

    Hi, I have a little problem with my themes search bar. Since I'm using WP to display just pages, not for blogging. I suppose It may cause the problem.

    When I use search box (upper right corner), I always get this 'Sorry, but you are looking for something that isn't here.' even if I'm searching for the same name as a page name.

    Could it be possible to reconfigure this search box so it searches through page contents ?

    Page

  2. songdogtech
    Member
    Posted 2 years ago #

  3. viltnieks
    Member
    Posted 2 years ago #

    Thank you,

    But I still can't get this to work, after installing plug-in and navigating to options I can choose every option except search every page, despite the fact that there is such section in screen shot of this plug in .

  4. songdogtech
    Member
    Posted 2 years ago #

    What exactly is the search code you are using in your theme? And try switching to the default theme and do a search and see what happens.

  5. viltnieks
    Member
    Posted 2 years ago #

    <!-- begin search box -->
    <form id="searchform" action="" method="get">
    <input id="s" type="text" name="s" value=""/>
    <input id="searchsubmit" type="submit" value=""/>
    </form>
    <!-- end search box -->

    this is the search code

  6. viltnieks
    Member
    Posted 2 years ago #

    I'm sorry for bringing this up again, but I would really like to solve this problem.

    I tried various plug-ins but none of them helped. I don't use default theme, and I use WP as a web site not a blog. All I want is for a search bar that just searches keywords through my site's page content. I tried various plug-ins and many settings, but when I try to search something I get "Sorry, but you are looking for something that isn't here."

    I red documentation for plug-ins. But I haven't had luck :(

    Theme I'm using isn't nothing special, and I think it shouldn't be hard to make this work, sadly I just don't know how :(

    Thank you in advance!

  7. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>" style="padding:0px 0px 0px 0px; margin:0px 0px 0px 0px">
    					<input type="text"  name="s" id="s" value="<?php echo wp_specialchars($s, 1); ?>"/><input class="input" type="image" src="<?php bloginfo('stylesheet_directory'); ?>/images/search.png" value="submit" style="border:0px"/>
    					</form>

    is my search form code....dunno if any of it helps ya

  8. viltnieks
    Member
    Posted 2 years ago #

    I tried using your code, but I still have the same problem :(

    I have a plugin enabled at the moment if you do a search in my search bar, you will get a nothing found error, but if you press "sākums" on upperl left, search results will appear.

    You can try doing a search for "mājas lapas" is my site and then pressing "sākums" on upper left, you'll see what I'm talking about.

    my site

  9. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    here's a couple things to try

    have you tested with NO plugins active?

    Also, set your permalinks back to default and test

  10. viltnieks
    Member
    Posted 2 years ago #

    Yes, I've tested with no plugins ,got same nothing found error.

    And with permaling back to default, I get exactly the same error :(

  11. viltnieks
    Member
    Posted 2 years ago #

    I tried using default theme, with no plugins and search worked just like I would like it to work :)

    But could someone please take a look at my site and tell me what could be the problem with this particular theme and search not working with it ?

    Thank you.

  12. songdogtech
    Member
    Posted 2 years ago #

    Do you have anything other than the standard loop:

    <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
    <?php endwhile; ?>
    <?php else : ?>
    <?php endif : ?>

    in search.php?

  13. viltnieks
    Member
    Posted 2 years ago #

    Yes, it goes like this:

    <?php if (have_posts()) : while (have_posts()) : the_post();if ($post->post_type=='page') continue; ?> 
    
    <?php the_content(__('Read more &raquo;')); ?>
    
    <?php the_time('F j, Y') ?> &nbsp;&nbsp;//&nbsp;&nbsp; <?php the_category(', ') ?> &nbsp;&nbsp;//&nbsp;&nbsp; <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?> &nbsp;&nbsp;//&nbsp;&nbsp; <?php the_tags('Tags: ', ', ', ''); ?> 
    
    <?php endwhile; ?>
    
    <?php else : ?>
    
    <?php endif; ?>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
  14. songdogtech
    Member
    Posted 2 years ago #

    What is this for? if ($post->post_type=='page') continue; ?>

    Try the standard loop intro

    <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>

    and see if search works.

  15. viltnieks
    Member
    Posted 2 years ago #

    Whoever made this theme I'm using probably added this.

    I tried standard loop as you suggested and it works.

    I'm very grateful ! Thank you.

  16. songdogtech
    Member
    Posted 2 years ago #

    Glad that works. I made the same mistake once, using a slightly off-standard loop.

  17. viltnieks
    Member
    Posted 2 years ago #

    It seems that I have a new problem now. :(

    Search function only works from front page (I have set a static page to display as my front page). I can search any keyword from my content, and It will find results. But If I go to some other page, other than front page I get "Sorry, but you are looking for something that isn't here." error.

    I'm using WP as a CMS and I suppose it has something to do with it.

    Any ideas ?

    edit: after setting my permalinks back to default search is working from every page. I was using /pagename or /postname. Is there a way that I can use /postname or /pagename permalink and have search function working from every page ?

  18. songdogtech
    Member
    Posted 2 years ago #

    Check the action in your search box; what you posted above is wrong. Should be

    action="<?php bloginfo('home'); ?>

  19. viltnieks
    Member
    Posted 2 years ago #

    Thank you again for you wisdom !

    I can just wonder how's that related to permalinks :p

Topic Closed

This topic has been closed to new replies.

About this Topic