Hey Matt,
By “doesn’t seem to function how I thought it would”, do you mean it does not function at all? I tested the instruction and it doesn’t work.
Before I give you what works, please note that I personally do not recommend hacking the elements with Javascript if there’s another JS code that has errors, modified element might get affected causing it to malfunction. If you could replicate the Featured Box with V2 elements, that would be ideal. You just need a Button or Social element for the Icon part and V2 Headline for the Text. You just then need to save the elements as a template to reuse them anywhere in your site.
Here’s what makes the Graphic Icon or Image a link on my site. We can’t make the paragraph text a link.
- Insert the
linked-feature-box
class to the Featured Boxes that you want to be linked. I just want to emphasize that you use class instead of ID like in the instruction. ID is good for 1 Featured Box only.
--------------------------------------------------------------------------------
- Make sure the Link Text and Href are set because this is where the icon will get its link from.
--------------------------------------------------------------------------------
- Copy and paste the JS code below in Theme Options > JS for global application. Or, Content JS for per page application. Remove the old code.
jQuery ( function( $ ) {
$('.linked-feature-box .x-feature-box-text a').each( function() {
$( this ).parent().parent().parent().find('.x-feature-box-graphic-inner *').wrap( '<a href="' + $( this ).attr('href') + '"></a>' );
$( this ).remove();
} );
} );
Hope that helps.