jQuery For WordPress SEO Plugins

05/10/2011

Hopefully this will help you with your website design. Manchester is surely a better place because of its existence.

WordPress SEO Plugins undoubtedly make SEO alot less labour intensive.  However it’s hard to keep control over the styling of the links these WordPress plugins automatically insert, especially if you use the ‘border-bottom’ CSS Property to decorate your links in your WordPress Theme. You could use the ‘text-decoration’ CSS Property instead, however you might consider this effect to be less palatable. Unlike the ‘text-decoration’ CSS property, the ‘border-bottom’ CSS property does not automatically inherit the text’s colour. This means possible clashes in colour between the colour of the text and the underline colour when these SEO WordPress Plugin links are automatically inserted.

To get around this difficultly the jQuery code below will make CSS ‘border-bottom’ property inherit the text node’s colour, just like the ‘text-decoration’ property.

$('.seo_link').each(function(){

var ghg = $(this).css('color');
$(this).css({'border-bottom-color':ghg});

});

For an example of this working please see the jsfiddle below.

http://jsfiddle.net/vct8s/