Here is my external link menu function for admin area:
##CACHE MENU
add_action('admin_menu', 'mariCacheDel');
function mariCacheDel() {
global $submenu;
$url = get_bloginfo('wpurl').'/cache/?do=deleteAll';
$submenu['themes.php'][] = array('MARIA CACHE', 'manage_options', $url);
}
How can we open a _blank
browser window with this link?
It has to be with jQuery and using a small trick in the admin_menu
to insert a target div with an ID:
add_action('admin_menu', 'mariCacheDel');
function mariCacheDel() {
global $submenu;
$submenu['themes.php'][] = array(
'<div id="maricache">MARIA CACHE</div>', // <-- trick
'manage_options',
site_url( '/cache/?do=deleteAll' )
);
}
add_action( 'admin_footer', 'make_maricache_blank' );
function make_maricache_blank()
{
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#maricache').parent().attr('target','_blank');
});
</script>
<?php
}