Created
December 14, 2014 19:10
-
-
Save enejb/ed1cac74e0bcc3fc68c8 to your computer and use it in GitHub Desktop.
This is a test plugin that can only be network activated.
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: Network Activated Plugin Only | |
Plugin URI: http://wordpress.org/extend/plugins/hello-dolly/ | |
Description: This plugin can only be network activated. And therefore it doesn't show up single site network admin page. | |
Author: Enej Bajgoric | |
Version: 1 | |
Network: true | |
*/ | |
// This just echoes the chosen line, we'll position it later | |
function eb_network_activated_plugin_notice() { | |
echo "<p id='eb-network-actiated-text'>I am network Activated!</p>"; | |
} | |
// Now we set that function up to execute when the admin_notices action is called | |
add_action( 'admin_notices', 'eb_network_activated_plugin_notice' ); | |
// We need some CSS to position the paragraph | |
function eb_network_activated_plugin_css() { | |
// This makes sure that the positioning is also good for right-to-left languages | |
$x = is_rtl() ? 'left' : 'right'; | |
echo " | |
<style type='text/css'> | |
#eb-network-actiated-text { | |
float: $x; | |
padding-$x: 15px; | |
padding-top: 5px; | |
margin: 0; | |
font-size: 11px; | |
color:red; | |
} | |
</style> | |
"; | |
} | |
add_action( 'admin_head', 'eb_network_activated_plugin_css' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment