Support » Themes and Templates » Search page not found

  • I’ve taken over a site from another developer and I’m having an issue with the search function.

    The search page and template and have created. If I leave the search form action as <?php bloginfo('url'); ?> it does the search and uses the search template but the url is http://localhost (not what we or the client want). If I set the action to <?php bloginfo('url'); ?>/search I get page not found, however if I navigate to http://localhost/search is displays the search page with no search results.

    I was able to kinda get it working by using http://localhost/search.php but then the pagination links don’t work and if you change to French it breaks (need to add /fr/ to the url).

    I also have Custom Structure set to /%category%/%postname%/ in Permalink Settings if that’s makes a difference.

Viewing 14 replies - 1 through 14 (of 14 total)
  • esmi

    (@esmi)

    Forum Moderator

    Try using <?php echo home_url(); ?> rather than <?php bloginfo('url'); ?>.

    get_bloginfo('url') and home_url() output the same url

    esmi

    (@esmi)

    Forum Moderator

    What values are set for the siteurl and home_url in the wp_options table of the database?

    site_url and home (couldn’t find home_url) are both http://localhost:8616 which is probably from the previous developer as I’m using MAMP Pro and have hosts set up (also this is a pull-down of a live site so those are wrong anyways).

    I was able to get it working by deleting the Search page and setting the search form action to <?=esc_url( home_url( '/search/' ) )?>. Looks like having the the page and the template named the same was causing some conflicts.

    I guess what happened was searchform.php had been created as a template part instead of a full template and search.php was applied to the search page that had been created. Oh the joys of taking over projects from closed dev shops…. Now if I could only figure out why I’m not getting proper search results and pagination.

    esmi

    (@esmi)

    Forum Moderator

    site_url and home (couldn’t find home_url) are both http://localhost:8616

    Is the site still running on that localhost url?

    Sorry, it never was… I may have caused some confusion in my original post when I was referring to localhost. I was simply using that because the host part was irrelevant. It was the rest of the url I was having issues with.

    esmi

    (@esmi)

    Forum Moderator

    Any chance we could see the real site?

    esmi

    (@esmi)

    Forum Moderator

    Judging by the returned url in the search page, that looks like a custom search.

    http://chfa.sajakfarki.com/search/?s=and&search_mode=site&search_mode_value=site

    as opposed to:

    http://example.com/?s=and&submit=Search

    using WP’s inbuilt search functionality. Is the custom search part of the theme or is it being provided by a plugin?

    It’s from the theme from what I can tell. The radio button toggles between built-in content search or querying a remote service.

    I don’t think passing the search_mode and search_mode_value params are necessary but I haven’t had the chance to test that yet

    esmi

    (@esmi)

    Forum Moderator

    given that this is a custom child theme based on commercial framework, have you tried contacting the framework’s vendors about this?

    They are no longer in business

    esmi

    (@esmi)

    Forum Moderator

    Other than hiring someone to go through this theme with you, there isn’t much else I can suggest.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Search page not found’ is closed to new replies.