in snippets, Uncategorized, WordPress

Add target=”_blank” to Mashmenu

If your site uses the Mashmenu plug and you would like one of your menu item links to open in a new window, Mashmenu provides the mashmenu_meta filter to do this. Just do a string replace on the href parameter to add the target=”_blank” parameter to the A tag.

Place this code in your theme’s functions.php file.

function mashmenu_page_content( $content ) {

	/* add target blank*/
	$content = str_replace('"', '" target="_blank"', $content);
	return $content;

} add_filter('mashmenu_meta', 'mashmenu_page_content');