Skip to content

Instantly share code, notes, and snippets.

@jpmarchand
Forked from gMagicScott/functions.php
Last active September 29, 2019 08:35
Show Gist options
  • Save jpmarchand/960a6243a98c9160ce5204d261c0b072 to your computer and use it in GitHub Desktop.
Save jpmarchand/960a6243a98c9160ce5204d261c0b072 to your computer and use it in GitHub Desktop.
<?php
//* Do NOT include the opening php tag
//* Add JS to allow elements to be faux anchors
//* Force links to be opened in a new tab
add_action( 'wp_footer', 'bg_script_clickable' );
function bg_script_clickable() {
echo '<script type="text/javascript">
jQuery(document).ready(function($) {
$(".content .entry").click(function() {
window.open($(this).find(".entry-title a").attr("href"), "_blank");
});
});
</script>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment