skip to Main Content

Open all portfolio entry links in a blank tab

// There isn't a function built-in for this for many reasons, but it can be done with javascript like the example below:
function wpex_add_target_blank_to_portfolio_entries() { ?>

		( function( $ ) {
			'use strict';
			$(document).ready(function() {
				$('.portfolio-entry a').attr( 'target', '_blank' );
		} ) ( jQuery );
<?php }
add_action( 'wp_head', 'wpex_add_target_blank_to_portfolio_entries' );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend Code Snippets)
Back To Top