Jump to content
Sign in to follow this  

Add Jigoshop Search Widget With Hook

Recommended Posts


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?




Share this post

Link to post
Share on other sites



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:

	// add_action('hook_name','function name');

add_action('pagelines_inside_top_branding', 'google_leaderboard_ad');

// function name
function google_leaderboard_ad(){
<div class="leaderboard">
Add PHP or other code here....

<?php }
// end function

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 http://www.pagelines.com/pros.

Former PageLines Moderator, Food Expert and Raconteur

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this