The Floating Social Bar plugin is a way for readers to easily share posts on their social networks – the key difference is that it’s very fast, and doesn’t front-load the loading of the all of the scripts for the social sites.
In actual fact, it’s in a very slightly different place to where it would be by default. You see, to make the plugin work for all themes, Thomas and Syed appended the FSB output to the top of the post content. And that’s fine for most cases.
Looking at a page with the Floating Social Bar enabled, in the Google Structured Data Testing Tool, I could see that the textual output from the Floating Social Bar was being included within the blogPosting
item text.
I didn’t want this. I’m not sure if Google actually uses this microdata value in any specific way, but I wanted to at least try and clear it up.
Moving the Floating Social Bar in Genesis
Here’s the solution for Genesis child themes (add to functions.php
). Other themes could do the same, except they’ll need to pick their own specific action hook on which to add the Floating Social Bar back in.
The code itself is documented with a couple of notes.
In Genesis child themes then, it simply moves the Floating Social Bar output from immediately after the <div class="entry-content" itemprop="text">
tag to immediately before it. Unless your entry-content has a background colour or a top border (which might be another reason for moving it anyway), you shouldn’t notice any visual difference.
Plugin
Since I’m going to be using this across all the sites where I use Floating Social Bar and Genesis, I’ve turned this into a plugin. Feel free to fork and improve or tweak to your own preference.
I was actually wondering about this the other day. I’m using the floating social bar on a few sites and I noticed it was causing an issue. OOP still throws my brain for a loop so I was banging my head on the desk about how to get the instance I needed to unhook it.
Thanks Gary!
Yeah, a singleton class, and the need to unhook after a particular point, combined with re-using a filter-based function on an action hook means it was never going to be something someone could just look at and spot, unless they spent a little while looking into it.
For most singleton classes, you’ll find that it as a
get_instance()
or similarly named method and you use a call to this with the real class name, in place of some global variable that has an instance of an object assigned to it.