Unfortunately due to other commitments, we are no longer able to provide support for these themes.

All our themes are now free and can be downloaded by anyone to use/modify however they wish.

We want to thank all our users for their support over the years. All the best in 2020 and beyond.

Custom search in header not appending to home URL

grahamvidlergrahamvidler Lifetime Member
Hi Mark,

I have added a custom search icon in the header area via the themedy-woocommerce.php file using the following code:


">



It is close to working, however instead of appending the search term to the home URL, it appends it to the current page URL. e.g.

Search for 'test' on this page: http://www.new.theskincareclinic.com.au/product-category/product-type/
Redirects to: http://www.new.theskincareclinic.com.au/product-category/product-type/skin-care-products/?s=test
Instead of: http://www.new.theskincareclinic.com.au/?s=test

If I place a search box in the sidebar, it works correctly, so I would imagine it is something to do with when the themedy-woocommerce.php file executes but I am not a coder!

I have tried variations of action="<?php echo home_url( '/' ); ?> but none of them will grab the home url.

I was wondering if:
a) you know what would cause this and how to fix it
b) you can provide me a quote to get this working (I appreciate it is a custom modification and falls outside of regular support)

Many thanks.

Comments

  • Options
    grahamvidlergrahamvidler Lifetime Member
    Code added with correct code tags...
    <form id="demo-2"> <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> <label> <span class="screen-reader-text">Search for:</span> <input type="search" class="search-field" placeholder="Search…" value="" name="s" title="Search for:" /> </label> </form>
  • Options
    Mark_HodderMark_Hodder Administrator, Lifetime Member
    Instead of trying to grab the home URL can you just hard code that right into your code maybe for an easy fix?

    Instead of:

    action="<?php echo home_url( '/' ); ?>

    action="http://www.new.theskincareclinic.com.au/"
    Need Additional Help?
    - Check out the Resource Center for helpful tutorials and hints.


    image
  • Options
    grahamvidlergrahamvidler Lifetime Member
    I did try that and unfortunately it doesn't work either. I have that code in there now and it is still appending the search term to the current page...
  • Options
    Mark_HodderMark_Hodder Administrator, Lifetime Member
    edited October 2017
    Weird, you can use the hire us / small tasks form for sure if you want us to figure it out. When you fill out the form just make sure to enter the FTP and WP admin login info for this site in the request box. The base fee of the small tasks form should be enough to figure out what is going on I'm sure.
    Post edited by Mark_Hodder on
    Need Additional Help?
    - Check out the Resource Center for helpful tutorials and hints.


    image
  • Options
    Mark_HodderMark_Hodder Administrator, Lifetime Member
    Taken care of via small tasks form.
    Need Additional Help?
    - Check out the Resource Center for helpful tutorials and hints.


    image
This discussion has been closed.