Quick Fix: WordPress Social Homes and LinkedIn Icon
NOTE: This article is out of date and likely obsolete.
The Social Homes plugin for WordPress displays a list of icons linking to your various social networking profiles* as a sidebar widget. When you update your list of sites, it calls out and automatically detects the location of each icon.
Unfortunately, the detection doesn’t work on LinkedIn, leaving your blog with a broken image, empty square or text label, depending on the visitor’s web browser. The plugin developer is aware of the issue, but several months have gone by with no fix.
So I’ve fixed it. Here’s how you can fix it on your blog.
Technical Details
First, some background. The problem is that Social Homes is expecting to see this pattern:
<link rel="shortcut icon" href="/path-to-icon">
But LinkedIn is using this equally valid pattern:
<link href="/path-to-icon" rel="shortcut icon">
This would be okay if it simply failed to find the icon, because it would fall back to /favicon.ico … which happens to be correct for LinkedIn. Instead it’s skipping past the end of the tag and picking up the next reference, which is currently a stylesheet.
The Fix
The simplest fix** is to just make sure it stops at the end of the tag, and let it fall back to favicon.ico.
Here’s what to do. Open up social-homes.php and look for the section titled, “Social Homes service parser.” The function you want is called widget_socialhomes_parse_service
Look for the section labeled, “grab the favicon” and find these two lines:
$tmpIcon1 = split('"shortcut icon"', $contents);
$tmpIcon2 = split('href="', $tmpIcon1[0]);
Add the middle line below, and change tmpIcon1[1]
to tmpIcon1a[1]
in what’s now the third line:
$tmpIcon1 = split('"shortcut icon"', $contents);
$tmpIcon1a = split('>', $tmpIcon1[1]);
$tmpIcon2 = split('href="', $tmpIcon1a[0]);
That’s it! All you have to do now is go back into your Widgets config, open up the Social Homes widget, and re-save it!