This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create custom selector for external links | |
$.expr[':'].external = function(obj){ | |
var $this = $(obj); | |
return !$this.is('[href^="mailto:"]') && !$this.is('[href^="javascript:"]') && (obj.hostname != location.hostname) && ($this.data('target') != "top"); | |
}; | |
// DOM is ready | |
$(function(){ | |
// apply target="_blank" to each external link on the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelectorAll('[target=_blank]').forEach(function(target) { | |
target.setAttribute("rel", "noopener noreferrer"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_thumbnail_url($post_id = null, $size = 'medium') | |
{ | |
global $post; | |
if (is_string($post_id)) { | |
$size = $post_id; | |
$post_id = $post->ID; | |
} |
OlderNewer