Untitled
unknown
plain_text
a year ago
1.1 kB
19
Indexable
function add_custom_jquery_to_header() {
?>
<script type="text/javascript">
jQuery(document).ready(function(jQuery) {
jQuery('.marketking_product_other_offer_container').each(function() {
var $container = jQuery(this);
var $productLink = $container.find('.marketking_other_offer_product_image').parent('a');
if ($productLink.length) {
var href = $productLink.attr('href');
$container.css('cursor', 'pointer');
$container.on('click', function(e) {
// Don't redirect if clicking on or within these elements
if (
!jQuery(e.target).is('a, button, input') &&
!jQuery(e.target).closest('a, form, .marketking_product_other_offer_third_column').length
) {
window.location.href = href;
}
});
}
});
});
</script>
<?php
}
add_action('wp_head', 'add_custom_jquery_to_header');Editor is loading...
Leave a Comment