Created
October 9, 2011 17:42
-
-
Save alanedwardes/1273949 to your computer and use it in GitHub Desktop.
WordPress plugin to add mint to the blog's header (if the user isn't logged in) and to add a "Statistics" menu option with Mint in an iframe.
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 | |
/* | |
Plugin Name: WordPress Mint Intergration | |
Description: Adds mint to the site's header (if the user isn't logged in), adds a "Statistics" menu option with Mint in an iframe. | |
Author: Alan Edwardes | |
Author URI: http://alan.edward.es/ | |
Version: 1.0 | |
*/ | |
function add_mint_javascript(){ | |
if(!is_admin() and !is_user_logged_in()){ | |
wp_enqueue_script('add_mint_javascript', get_bloginfo('home') . '/mint/?js', array(), null); | |
} | |
} | |
add_action('init', 'add_mint_javascript'); | |
function mint_iframe() { | |
echo '<iframe src="' . get_bloginfo('home') . '/mint/" frameborder="0" scrolling="no" width="100%" height="2000"></iframe>'; | |
} | |
function mint_menu() { | |
add_menu_page('Mint: Statistics', 'Statistics', 'manage_options', 'mint', 'mint_iframe', get_bloginfo('home') . '/mint/app/images/favicon.png'); | |
} | |
add_action('admin_menu', 'mint_menu'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment