Are you a professional WordPress Web Developer looking to sync your blogroll from one source to multiple WodPress blogs? Or maybe you’ve got some great links on one blog that you just want to transfer to another? Perhaps you’re a WordPress SEO professional looking to create a continuously growing list of links on your various WordPress blogs just by updating 1 source blog?

If you are, then you may want to try out the WP LinkSync plugin by DCoda Ltd (previously named WP BlogrollSync).

I’m going to admit, that it’s not perfect (yet). However, in this post, as well as reviewing this WordPress plugin, I’ll be outlining how the WP LinkSync plugin can be hacked to get it to do what you need. (I’ve also left a comment on the DCoda WP LinkSync page, so hopefully, they might implement these changes without you having to hack the files like I’m about to show you!).

This post will also look at the relatively undocumented WordPress OPML feature that can be used for importing existing blogroll links into a new site. Did you even know that you could do this?

Firstly, why would you use this plugin? Well, I’m currently in the process of creating a system to build a network of sites all of which are all contextaully relevant and in the same niche. It would be extremely useful to have a list of links from each WordPress site I build pointing to each other.

As I build a new site, I’d like to have existing blogs point to the new site to help it get indexed effectively and quickly in Google. In order to do this, all of the existing blogs/sites would need to have a mechanism to automatically update and include the new site in their list of links. By doing this, the network of contextually relevant grows; Google is happy as this isn’t a link farm and instead a list of extremely useful, well thought out resource. And each site points to each other without any need to do anything. The only thing that I would need to do is to update the source site’s blogroll links.

Can you imagine how powerful this technique can be? Any SEO professional (or even SEO newbie) knows the value of external links. Having several sites pointing to 1 sites is great. Having those sites automatically update and a constantly growing network of good links is even better!

The idea is pretty simple. Saying that, not everyone would think of doing it. At Knowledge Constructs, this is precisely the type of solutions focused idea that you get when working with us. Really powerful solutions that redefine the box rather than just get out of it!

So, now you understand why you’d want to do this, let’s have a look at the actual WP LinkSync plugin, the limitations and ways in which this can help you if used correctly.

WP LinkSync Plugin

I love the idea of the WP LinkSync plugin and it’s certainly a useful tool for syncing links easily. It’s okay at the moment and with a few minor modifications it will be excellent.

WP LinkSync Basic Concepts

You will need 2 blogs. A “source” blog to pull links from and a “target” one to import the blogroll links to. WP LinkSync extends the basic WordPress import blogroll function and pulls information from the wp_links_opml.php file. We’ll be looking at this WordPress OPML generation file later on as well as ways to extend both the file and WP LinkSync too!

Using WP LinkSync plugin

As with all WordPress plugins, you simply upload the folder to your /plugins/ directory and Activate it. No surprises here.

After logging into your WordPress admin area and clicking on Manage / LinkSync you get 3 fields and 2 buttons.

  • Central List URL (field)
    This is where you specify the address of your WordPress source OPML file.
    This is usually located at: http://{your domain name}/{wordpress root}/wp-links-opml.php
    For example, as I’m using WordPress installed on the root of my site you can see all of my blogroll links in a nice xml format just by going to http://knowledgeconstructs.com/wp-links-opml.php
    (your blog may vary).
  • Categories (field)
    These are the categories that you want to have WP LinkSync to pull in.
    For example, if you go to the Knowledge Constructs blogroll (or Links page) you’ll see that it contains 2 categories for SEO Links and WordPress Plugin Links.
    In my target site/blog, I might want to pull in just the “WordPress Plugin Links” or the “SEO Links”. If I wanted to do both, then it’s easy enough to separate this field with commas.
  • Refresh Time (field)
    This value is how often the WP LinkSync plugin refreshes (in hours). Probably best to set this at 24 or 48. By default this value is empty.
  • Sync Now (button)
    Used to sync links right away. A very well labelled button, this one…

  • Save Settings
    Again, another well labelled button that allows you to… well, save the settings (if you haven’t guessed already!).



wp-link-sync-screenshot.png


And that’s it. It’s pretty simple to use.

WP LinkSync Tests

Upon testing the WP LinkSync plugin there was an initial problem that was highlighted in the comments by Diego on the DCoda site: All blogroll links get deleted!

Thankfully I’m smart enough to actually check plugins before I implement them on a live system, so checking this on my local machine, I found that it definitely *DOES* delete all of the blogroll links completely.

“WTH? How’s that useful”, I hear you ask!

Well, it’s great if you’re importing your links to fresh new blogs. This is plugin is perfect if this is all you want to do. However, it’s not good news for importing links to an existing blog!

STOP! Before you give up on this plugin, (as usual) I’ve got some good news. Regular readers know that I often find ways to hack files to make WordPress *really useful* and guess what? Well, I had a look at the LinkSync files and this problem is actually very easily fixed!

How easily? Well… it’s 1 line (with a caveat! See below).

Automatic Updates

WP LinkSync does have the feature to automatically update your links, however at the time of this testing I’ve not been able to verify if this WP cron functionality works (as I’m using a Windows local test machine which probably isn’t configured properly!). If anyone can confirm whether this functionality works, then that would be appreciated.

Hacking the WP LinkSync plugin

As usual, please back up your files before doing this and make a copy! With any luck DCoda Ltd might actually implement this fix, so you might not even have to do this… For people who need this *NOW*, here’s how to do it.

Open the /blogrollsync/classes/blogrollsync/base.php file.

Go to line 96 and you’ll notice it currently says:

wp_delete_link($link->link_id);

Change “delete” to “update” so you get:

wp_update_link($link->link_id);

And guess what? This seems to work just fine. I’ve tested this fix using WP2.5.1. What happens now is that the OPML file will import the category you specify and leave existing links alone.

CAVEAT FOR THIS FIX: The only thing is that any existing links in a specified category with the same name you’re pulling into will get deleted. For example, if you already have a category called “Great Links” and you import the OPML and specify that you want to pull in “Great Links” from the external souce site, then links you already have will get deleted.

With this in mind, it’s actually not that bad. All you have to do is to ensure that the blog you’re pulling into doesn’t have the same category already defined. If it doesn, then change either the source or target categories and you should be okay!

WP LinkSync Plugin Summary

At the moment, WP LinkSync is definitely an interesting plugin with a lot of potential. It’s definitely worth a look if you want to import your links.

So, what are the possibilities from using this plugin? Well, extend the basic idea out – in theory you could build a huge resource of links very quickly if you find lots of contextually related WordPress sites and then import their OPML data into your site.

As you’ve seen, you’d only need to go to http://{the domain}/{blog location}/wp-links-opml.php. A huge list of links could be imported very quickly and all you’d need to do is delete any irrelevant ones!

On the whole, I’d say with a few fixes WP LinkSync could really be an excellent plugin for WordPress Developers and SEO professionals to use.

WP LinkSync Suggestions

My suggestion to DCoda Ltd was that if they amended either the code so that existing links in categories could be kept then that would be perfect. Alternatively, simply stating in the documentation that existing links in a category will be deleted, then at least that manage people’s expectations.

How about this new feature: pulling in data from multiple OPML Sources? Imagine what could be done if you could have several sources – a really great list of useful links could be created.

Superflying WP LinkSync
(By Extending WordPress OPML Data!)

Here’s an idea to make the plugin even better: extend the information that is output by the wp-file-opml.php file.

At the moment (no idea why) but WordPress only generates the blogroll Categories, the “text”, the “link type” and the “html url”.

Well, anyone familiar with WordPress template tags will know that the blogroll has a lot of very useful information that could be used. For example, the “description” field would be a great information to have imported to your target blogroll. If you look on the Knowledge Constructs Links page, you’ll see that we use the descriptions all the time.

So… can this be fixed?

You know me – yes it can. I don’t bother blogging about it unless I feel this stuff is useful! So here’s how it’s done!

How To Extend WordPress OPML Information
(By Amending The wp_links_opml.php File)

Again, backup your existing souce wp_links_opml.php file before you do this! Replace it with a new one.

At the moment, the wp_links_opml.php file doesn’t output useful information like “descriptions” and all the other funky information that blogrolls contain.

Are you ready to add some descriptions?

Open the wp_links_opml.php for the source site you’ll be importing from. This file is found in the root of you blog – wherever you installed WordPress. On this site, it’s actually at the site root.

On line 42 add the following:

description=”<?php echo attribute_escape($bookmark->link_description); ?>”

somewhere on this line, so that it will output descriptions to your OPML data. Note: link_description can be changed to be any other tags you can find on the WordPress codex relating to blogrolls/bookmarks!

Now, check your output file by going to http://{your domain name} / {wordpress root} / wp_links_opml.php. Your OPML data should now include the “Descriptions”.

Upgrading The WP LinkSync Plugin

Now it’s time to amend the WP LinkSync Plugin to handle the new data. This again is very simple to do.

Firstly, remember to back up any files you’re going to amend.

Open:

/wp-content/wp-plugins/blogrollsync/classes/blogrollsync/base.php

Around line 126, insert the following code:

$BLink['link_description']=$Link['link_description'];

Save the file.

Now, open:

blogrollsync/library/classes/feed.php

Around line 41, insert the following code:

$link['link_description']=$Link['description'];

Save the file.

And you’re done!

Now when you use the WP LinkSync plugin, you’ll notice that the descriptions are also pulled in.

Summary

As you can see, this plugin has the potential to be *extremely* useful for search engine optimization purposes or even if you just need to import your existing WordPress blogroll links.

While the WP LinkSync plugin is great for what I need it to do at the moment, it would be great to be able to install and use this plugin properly without having to hack the files.

If you feel the same way, get in touch with DCoda Ltd and let them know you’d like to see these changes implemented too! While your at it, anyone over at WordPress want to extend the data being output in the wp_links_opml.php file? Seriously guys, it’s only a couple of minutes but could potentially help to create excellent contextually relevant resources across the Net!

Just an idea… (I’m just sowing seeds) ;)