WordPress.org

Ready to get started?Download WordPress

Forums

Search page not found (15 posts)

  1. kidcardboard
    Member
    Posted 1 year ago #

    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.

  2. esmi
    Forum Moderator
    Posted 1 year ago #

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

  3. kidcardboard
    Member
    Posted 1 year ago #

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

  4. esmi
    Forum Moderator
    Posted 1 year ago #

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

  5. kidcardboard
    Member
    Posted 1 year ago #

    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.

  6. esmi
    Forum Moderator
    Posted 1 year ago #

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

    Is the site still running on that localhost url?

  7. kidcardboard
    Member
    Posted 1 year ago #

    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.

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    Any chance we could see the real site?

  9. kidcardboard
    Member
    Posted 1 year ago #

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    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?

  11. kidcardboard
    Member
    Posted 1 year ago #

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

  12. kidcardboard
    Member
    Posted 1 year ago #

    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

  13. esmi
    Forum Moderator
    Posted 1 year ago #

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

  14. kidcardboard
    Member
    Posted 1 year ago #

    They are no longer in business

  15. esmi
    Forum Moderator
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic