How to Integrate OutBrain Widgets Manually on WordPress Blogs

July 14th, 2012 | No Comments | Posted in Php & MySql, Programming, Science & Technology

If you have been searching for the best option to display related posts on your blog, then its suggested to opt for a service which is not hosted on your blog and which is offered by a third party service provider with the main advantage being that you don’t have to expect any server loads.

We have earlier discussed on the best related posts plugins for your blog and what all should be implemented and what should be avoided. We have tried the linkwithin plugin and also other plugins but the best of all would be the one offered by Outbrain because of the flexibility and the perfection in the display of your related blog content.

You can find that we have implemented this service on our other blogs and the way they have displayed the widget is very good. The service comes with multiple options when you select the Get Blog widgets options ranging from Text & Text + Thumbnail type widgets which are free to use and can be implemented within 60 seconds on your blog. You can implement the same on WordPress, TypePad, Blogger, Drupal, Sqyarespace or any other website type using the Javascript Embed options. If you select the WordPress option then its available only for the self hosted blogs in the form of a plugin with limited areas to implement the same, but when you would like to implement it anywhere on your blog then its suggested to select the Javascript option.

You will be given a Javascript like the following which has to be placed in your theme / template files where you would like to render the related posts.

You just need to ensure that you replace the ‘DROP_PERMALINK_HERE’ line with your blogs permalink code which will make the plugin work perfectly. In case of a self hosted blog this has to be replaced with which is the correct code. Once done you need to ensure that you have added the following code at the end of your functions file just before the ?> of the functions.php file.

function currentPageURL() { $curpageURL = ‘http’; if ($_SERVER["HTTPS"] == “on”) {$curpageURL.= “s”;} $curpageURL.= “://”; if ($_SERVER["SERVER_PORT"] != “80″) { $curpageURL.= $_SERVER["SERVER_NAME"].”:”.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $curpageURL.= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $curpageURL; }
Once you have added the code in the functions file followed by the above outbrain code in the templates file, the widget would start rendering the related posts automatically and sometimes it would take upto a few hours for the service to index all your content and generate a screenshot for the same. Once done you also get other options like showing Recommendations in your posts, showing paid advertisements or giving away the same under the list of charities mentioned in your outbrain account.

Leave a Reply 66 views, 1 so far today |

Most Commented Posts

Leave a Reply

Refresh Image