Hi there, using Widget «ENFOLD ADVERTISING AREA» the images link with “target=_blank” to URL. How can I change _blank to _self?
Do you know, if there is a Plugin to show WooCommerce products on a Sidebar filtering by Category? Not only as list, I need Images and text with URL to product as it comes with Widget «ENFOLD ADVERTISING AREA».
Hey Stephan,
You can show the Enfold Advertising Area widget on certain categories and pages using the Widget Logic plugin.
You can force all links to open in the same window or tab with this code to the end of your functions.php file in Appearance > Editor:
function force_links_self(){
?>
<script>
(function($){
$(document).ready(function(){
$('a[target="_blank"]').removeAttr('target');
});
})(jQuery);
</script>
<?php
}
add_action('wp_head', 'force_links_self');
Or if you want this to only work on your “Premium advertising space” sidebar area, please use this code instead:
function force_links_self(){
?>
<script>
(function($){
$(document).ready(function(){
$('a.preloading_background[target="_blank"]').removeAttr('target');
});
})(jQuery);
</script>
<?php
}
add_action('wp_head', 'force_links_self');
Best regards,
Mike