• Hello,

    I’m having problems with the native search on my wordpress site. I followed all the instructions on this page…

    https://codex.wordpress.org/Creating_a_Search_Page

    … and I set up a search page using a search page template. For now this is just a blank page with URL /search with the search box on it.

    However, when I type a keyword into the search box, such as “irrigation” (which should bring up tons of results on my website), and click the search button, it brings me to the /?s=irrigation results page successfully, but it doesn’t display the actual results – only grey dotted lines. When I inspect element on the page, I can see that these dotted lines are just CSS borders for what should be the results themselves, and I can see the individual divs for the specific search results in the code, but they’re just empty – as shown:

    <div class="post-8561 page type-page status-publish hentry post_box top" id="post-8561">
    </div>
    <div class="post-8560 product type-product status-publish has-post-thumbnail post_box taxable shipping-taxable purchasable product-type-simple product-cat-outright instock" id="post-8560">
    </div>
    <div class="post-8559 product type-product status-publish has-post-thumbnail post_box taxable shipping-taxable purchasable product-type-simple product-cat-outright instock" id="post-8559">
    </div>

    The system knows how many and which exact products/pages/etc should be returned in search results, but it doesn’t display the actual content.

    Any idea on what could be causing this problem?

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    pastebin the code for your custom search page (search.php) if you created a custom search results page.

    Use pastebin.com or wpbin.io.

    Hie kcox117,

    The problem seems like to be in your search.php file.
    In your active theme, please make a file named “search.php” and just write the following code :

    if(have_posts())
    {
     while (have_posts())
      {
       the_post();
      the_title();
      the_excerpt();
     }
    }
    else
    {
     echo “No Search Results To Show”;
    }

    Hope this will work.
    Once you got the core result, page can be designed accordingly.

    Maybe something in the functions.php filtering/excluding from queries?

    Thread Starter kcox117

    (@kcox117)

    I will be posting that code shortly, but I just wanted to let you know I tried cedcommerce’s code. I created a search.php file in my active theme folder with that code pasted in between <?php & ?> tags, and when I search, I’m getting a PHP error, just a white screen.

    Thread Starter kcox117

    (@kcox117)

    Based on the instructions for “Creating a Search Page” (link in parent post), I created a Custom Search Template and called it searchpage.php that has the following code:

    http://pastebin.com/7ZFt4Hxd

    And I created a page in wordpress with url /search that uses that search template. When I go to /search in the browser, I see a blank page with the search box on it, which is good, but when I try to search, it takes me to a /?s=(keyword) page with the proper amount of returned search results, but the results themselves are not displayed, just dotted borders. When I firebug the page I see that the Divs are all empty.

    My theme folder does not have a search.php file in it. When I create one and use the code from cedcommerce in conjunction with my search template, the /?s=(keyword) page instead shows just a blank white screen, indicating some sort of php error, I believe.

    Also, per AjitKhodke’s suggestion, i tried deleting all my custom functions, then i retried it, and the same result – all divs still empty.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    what is it you’re trying to accomplish? If you just want to format the search results, create / edit the search.php from your theme. You said your theme does not have a search.php file. What theme are you using?

    Thread Starter kcox117

    (@kcox117)

    What I’m trying to do is set up a standalone search page on my website – basically a page with a search box on it. When the user executes a search, it takes them to a page showing all the search results. Let me know if I need to further clarify. I’m using an older theme called “thesis_18”

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    OMG — thesis 1.8.6 is several years old and only barely works with the current version of WordPress and is not mobile friendly. You should make a new theme for your site. Seriously, stop what you’re doing and consider that direction.

    Thread Starter kcox117

    (@kcox117)

    Sterndata, I do realize it’s a really old theme, problem is though that it is extremely customized with all of our own pages, the theme serves more of just a framework than anything. How difficult is it to change a theme and still maintain all our custom designs? Our website is a woocommerce store that handles several transactions every day.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    You should invest in a new theme.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Problem with WordPress Search’ is closed to new replies.