Skip to content

Instantly share code, notes, and snippets.

@enejb
Created December 14, 2014 19:10
Show Gist options
  • Save enejb/ed1cac74e0bcc3fc68c8 to your computer and use it in GitHub Desktop.
Save enejb/ed1cac74e0bcc3fc68c8 to your computer and use it in GitHub Desktop.
This is a test plugin that can only be network activated.
<?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