phpBay Search2Post and Other Goodies like phpOStock!
If you are a phpBay user… which at this point, I don’t know why you would NOT be… there is a plugin called Search2Post written by Alan Lewis, that can make your day so much easier! I briefly mentioned it yesterday in my post about Prioritizing your Time. Essentially, the Search2Post plugin takes the search stings typed into a widgetized search box and automatically creates a new post on your WordPress blog, populated with the products the user was looking for! Finding topics for new content is just no easier than this, since the posts are coming from actual visitors!
Along with the Search2Post plugin, Alan has also released a new plugin called phpOStock ($30), which takes advantage of the Overstock affiliate program and just like phpbay, pulls in Overstock item listings to your blog posts or pages! If you have never seen Alan’s plugins, its worth checking into! If you are worried about ePN just not keeping up to par with your expectations, phpOStock may just be the perfect solution!
Getting the Most from Search2Post
The process is pretty simple:
- User Visits Site
- User Searches for Something
- Search2Post Automatically Creates a New Post based on the Search String, and shows the user listings from eBay!
As much as I love the Search2Post plugin, the one weakness I found, is in creating blank pages, or pages with very little content. In the eyes of search engines, the pages created by the plugin can be considered thin and duplicate. If you have a site that has several searches done every day, there are a few ways to prevent blank and junk pages from appearing in the search index. We already know that duplicate content gets you nowhere and Search Results pages should not indexed! So… how do we avoid this with Search2Post?
Preventing Search Generated Pages from being Indexed
The heading of this paragraph is somewhat misleading! Even though we DO WANT these new pages to be included on our site, we DON’T want them to be indexed until we have reviewed them completely, added relevant content and made them a valuable resource to both readers and search engines. The main objectives I had when I installed Search2Post were:
- Prevent Indexing until Reviewed and Optimized by Me
- Keep ALL Search Generated Posts Temporarily Quarantined from Visitors!
- Prevent Newly Generated Pages from Appearing in Feed and Being Automatically Pinged to Engines!
STOP – Make a Backup Copy of your Search2Post Plugin files BEFORE Making ANY Changes! If you mess up, bringing it back is a simple fix! In the following steps, we are going to edit 2 or 3 files, depending on your own preference:
- phpbay-Search2Post.php (Inside the search2post plugin folder)
- header.php (Inside your current wordpress theme folder)
- Optional to exclude Search generated page category: sidebar.php in your theme folder.
- Review and Publish your New Pages
I have included notepad text files of the code. I suggest using them versus copying from this page. IF you copy from this page directly, it will likely not work due to code skewage!
1 – Prevent Indexing with the Robots Meta-Tag in Header
1a – In the phpbay-search2post.php file, on line 55 you will find the following string, that begins a LONG series of database inserts:
$wpdb->query("INSERT INTO $wpdb->postmeta(post_id,meta_key,meta_value) VALUES ('$thenewpostid','title','$pageorposttitleunique')");
This same string carries on much further, to insert all needed information into your WordPress system, creating the page. Immediately AFTER the string above, yes, it will be right in the middle of the full string, paste the following code: (search2post.txt text file)
$wpdb->query(“INSERT INTO $wpdb->postmeta(post_id,meta_key,meta_value) VALUES (‘$thenewpostid’,'noindex’,'noindex,follow’)”);
Save the file. If you edited it locally, upload it to your hosting account. What we have done in this step, is tell the newly created page to also add a WordPress Custom Field named “noindex”, populated with the values of “noindex, follow”. Now we need to tell our header.php how to deal with it.
1b – Open the header.php file of your current theme in WordPress. AFTER the meta information for content type,we need to add in a method for handling the new noindex,follow code. Essentially, we are going to add a custom meta-tag to our header and tell search engine spiders to stay out for now!
Find this code: (Yours may differ, but it should be within the first 5-10 lines of your header file)
<meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />
Immediately after this code, paste the following: (header.txt text file)
<!--edit to block/allow search result page indexing, only if page has been reviewed and deserves to be in index-->
Save the file. If you edited it locally, upload it to your hosting account. What we have done, is told our header file to check the post for a custom ID named “noindex”. IF it exists, add the noindex,follow meta tag to the page. If it does NOT exist, show the normal “index,follow” tag to search spiders.
We have now Stopped the pages from being indexed! BUT… what about hiding them from the regular viewers, who may not want to see blank pages, or pages we have no control over?
2 – Put ALL Search Generated Posts in their Own Category
When you setup the Search2Post plugin, it asks you which category to create the new posts in. I created a category called Product Search and every post goes into it automatically as they are created. In my Category Tree, I wanted to hide this category from visitors, so I simply added the “Exclude” option to the menu.
In my case, I am not using a Widget, but using the standard “wp_list_categories” within the sidebar file. To exclude my newly created category, I just added the option to the code:
< ? php wp_list_categories(‘orderby=name&title_li=&depth=1&exclude=115‘); ?>
The number 15 in the above example is the wordpress category ID number. To find yours, just go into your wordpress admin, click on the category editor, click on your Search2Post category, and look in the top address bar for the cat_id=number. It will look like:
www. yourwebsite .com/wp-admin/categories.php?action=edit&cat_ID=115
Again, if you chose to hide your search pages, save the file and move on to the next step.
3 – Use MaxBlogPress Ping Optimizer to Control Ping Frequency
One of the biggest risks of using this plugin on a busy site… is the constant pinging of search engines! Eventually, they will not like you hoitting them so often and will label your site as spam! That’s not good! On my site, the search box is used anywhere from 20-30 times every day right now and it is gaining popularity! In order to control the number of times the ping services are hit, I installed the MaxBlogPress Ping Optimizer plugin, and limited the automatic ping to only ONCE per day. (1440 minutes)
This gives me the time to review the posts BEFORE they are sent to search engines!
4 – Review and Publish!
Now that you have a new page generated by the Search2Post plugin, the only thng left to do is review it, add related content to the page and publish it again! The way I do this is pretty straight forward. Since the page has never been indexed in search, the first thing I do is move it to its appropriate category! After I have moved it to the right category, I simply delete the “noindex” custom field generated by the plugin, and the page is now live!
The next time your site pings to search, the page will be included in the pingshot and will be indexed as normal!
I hope this helps you all out. If you run into issues, just post here so we can work it out!
Links in this post:
Previously Published Articles You May Like to Read:
- Converting from BANS to phpBay, Method 2
- Changing from BANS to PhpBay – Method 1
- Should you Convert a BANS Site to a PhpBay Site?
- 25 Things about Me – and a Cool phpBay Discount Code!
- The Build a Niche Store Template for WordPress
- Converting WordPress Theme to BANS Template – FAQ
- BANS Template for WordPress – Simple CSS




ohhhh my head hurts haha! Thanks for taking time to post this Mark, can’t wait to try it out! PHPbay is GREAT!
Hi Mark
Many thanks for the great post covering my plugins phpOStock and Search2Post. Much appreciated.
Just wanted to mention that I am releasing an upgrade to Search2Post within the next few days that has some very neat new features.
The dependence on phpBay has been removed. So anybody can use it, whether you have phpBay installed or not. Easy to build good original mashup pages now from multiple data sources like phpBay and phpOStock.
The formatting of the output posts/pages has received a complete face lift. This is now controlled by an external template (and can optionally include a CSS style sheet). The look and content of the auto-generated page is now limited only by imagination.
I am also looking to add your no-index suggestion as an additional option in the configuration screen, so guys can just switch it on or off as they wish.
There are a few other handy user suggestions being added as well.
Its evolving into a really useful plugin :-)
Cheers
Alan
I bought this plugin yesterday after reading over this review… Very impressed indeed by the features it can add to a phpBay site.
Also: many of the feature requests Mark talks about in this post HAVE been implemented since this blog post. There is now an option to simply check a box to turn on the “no Index” feature. No longer have to use Marks code-hacking technique.
Thanks for the heads up on the great plugin Mark!
Thanks for the heads up on the great plug-in Mark!
[...] Change instructables from orange! [...]
Leave your response!
On My YouTube Playlist
Latest Twitter Updates
Posting tweet...
Site Categories
Monthly Archive
My Favorite Places
Blogging Sites
Blogroll
Places I Write
Technology Sites
Site Credits
Niche Store Builder is powered by WordPress, using a modified theme originally inspired by Arthemia.
Home | About | Contact | Mark Hansen @ Google | Terms & Privacy