Want to maximize your Wordpress earnings with phpBay Pro? Most every Wordpress theme has a search.php file in the theme folder of the theme you are using. There are some that do not, but for the most part, they do.
The idea is, rather than returning blog post results when the user performs a search, instead, we return Ebay auction items that match the search term. Not everyone will want to do this, but I’ve had a number of customers ask for this.
Before getting started, be sure that phpBay Pro Wordpress plugin is installed, activated and working properly. Next, make a backup copy of your theme’s search.php. I say again, make a backup copy of your theme’s search.php. This example is using phpBay Pro Wordpress Plugin 2.5+. Note: this is updated as of April 1st, 2008 for the new 2.5 release.
The next part is tricky, because in virtually every theme, the search.php varies slightly because of theme layout, etc. So, to illustrate this, we’re going to switch over and use the default wordpress theme that comes standard with every Wordpress install. This way, I can post before and after code that will illustrate what needs to be done, with an example that is stable and consistent.
Here’s what the search.php file from the default theme looks like, without any modification:
Basically, we will modify the center “guts” of the search.php file with a slight change to the < h2 > so that when a visitor to the site enters a search term, we return Ebay auction items (Note: This code has been updated for phpBay Pro 2.3):
Compare the original file code in the first entry above, to the modified file code entry just above. The phpBay code is the constant. Where you place it in your search.php will depend upon the theme you use and how the search.php file is constructed. This is why it’s important to make a backup copy of search.php first. It might take a time or two to get it right, but once done, can be an additional source of revenue for your blog.
Related Articles
4 users responded in this post
This is a great idea. I tried it a few times and got errors initially but then got a results page that didn’t have any auction listing and I know there should be some.
Any ideas where I should look for a solution?
Hi Holly. Send me an email with a link to where I can download the Wordpress theme you are using. I’m happy to do this for you, and return the search.php page for your theme, so you can simply plug it into your theme.
Replacing the search is awesome! Is there code for the v 2.3 plugin? I’m getting an error saying to set the affiliate id in the control panel when using the code above (and the affiliate id is already set). Thanks much!
Hi Mark,
I’ve updated the code above to the 2.3 version now.