How to Open YARPP Links in a New Window?

Follow

If you’re comfortable with a bit of jQuery/JavaScript, you can do something along the lines of the following to open YARPP links in a new window:

jQuery version:


<script>
jQuery(document).ready(function($) {
 $(".yarpp-thumbnail").attr("target", "_blank");
});
</script>

Vanilla JavaScript version:


<script>
document.addEventListener('DOMContentLoaded', function() {
  var yarpp_els = document.querySelectorAll('.yarpp-thumbnail');
  for (var i=0; i < yarpp_els.length; i++) {
    yarpp_els[i].setAttribute('target', '_blank');
  }  
})
</script>