Reply To: automatic searching via link

Ernest Marcinko
Ernest Marcinko


Well, that’s not possible unless with some extra code. I’ve taken some time to experiment and came up with a possible solution.

This solution will basically target a specific group of links and perform a search based on the link text and scroll the screen to the search bar to be visible.

1. Custom Javascript code. Put this code to the footer of your theme footer.php file, just before the closing body tag:

jQuery(function($) {
    }, 300);
    $('body, html').animate({
        "scrollTop": $('input.orig').offset().top - 100
    }, {
        duration: 500

2. For links you want to trigger a search, add this class: “do_search”, like so:

If the user clicks on this link a search will be performed and the screen scrolled to the search location.

Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)