Jump to content

- - - - -

Add Jigoshop Search Widget With Hook

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 steck1983



  • Members
  • 27 posts

Posted 25 December 2012 - 10:36 AM

Hi guys,


merry christmas...


I need to add the jigoshop search widget to the head area of my page. I added a few other things by using various hooks such as "pagelines_before_branding",  and modifying the functions.php file etc..


Now I can get the default wordpress widget to appear by using  get_search_form(); since the default wordpress widget starts as a function... The jigoshop widget starts as a class:


class Jigoshop_Widget_Product_Search


How would I call this within my themes function.php file?


I tried doing this: <?php Jigoshop_Widget_Product_Search::widget(); ?> but


I get an error asking for 2 arguments $args, $instance which appear in the jigoshop widgets code like so "public function widget( $args, $instance )"


What do I put for these 2 variables?


The reason why I'd like to use the jigoshop widget is that it will search only for products... Or is there a quick way to modify the wordpress search widget to do the same?




#2 Rob


    One Smart Egg

  • Members
  • 13575 posts

Posted 26 December 2012 - 06:54 AM



Well, modifying the default WP search would mean editing core files, but you can create a hook.  We have a new premium product called Hooker that helps write hooks. It's in the Store.


Also, you can apply the PHP tag inside a text widget, placing that at the top of your sidebar, if you'd like.  


As for the errors, I presume you did not correctly close PHP before opening the new PHP tag, then close that and reopen PHP before ending the hook. I imagine that confused you as much as it did me.


A hook is a snippet of code added to the code running the functions of your site.  Since the basic functions include running PHP processes, when you add a new hook, you're effectively breaking into the sequence of PHP processes (coded) and throwing a new process into it.  If you don't close the original grouping before interjecting new code, it will doubtlessly throw an error.  See my example below:

Please Login or Register to see this Hidden Content

Now, you see the ?> which ends the PHP code? Then in between there and the re-opening of PHP with <?php is where your code goes.


The Hooker plugin does all this for you, effectively letting you select the location (the hook) then giving you a field where you can paste your actual function (the jigoshop php search call).


If you're really not comfortable with all this, I'd highly recommend engaging one of our pro developers via

Please Login or Register to see this Hidden Content