Skip to content

Instantly share code, notes, and snippets.

@alanedwardes
Created October 9, 2011 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanedwardes/1273949 to your computer and use it in GitHub Desktop.
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.
<?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