Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Created November 22, 2013 17:32
Show Gist options
  • Save dwelch2344/7603789 to your computer and use it in GitHub Desktop.
Save dwelch2344/7603789 to your computer and use it in GitHub Desktop.
A simple (ugly) test plugin admin screen for Wordpress
<?php
/*
Plugin Name: TestPlugin
*/
function test_plugin_menu(){
add_options_page('TestPlugin Settings', 'TestPlugin', 'manage_options', 'test-plugin-menu', 'test_plugin_options');
}
add_action('admin_menu','test_plugin_menu');
function test_plugin_options(){
// include('admin/super-plugin-admin.php');
$confirm = $_POST['tp_confirm'];
if( $confirm == 'DOIT!' ){
echo "Okay, run it... <br/>";
$output = shell_exec('echo HI!');
echo "<pre>$output</pre><hr/>";
}
?>
<form name="form1" method="post" action="">
<p>This plugin will promote your staging changes into production. You must enter "DOIT!" in the following textbox to confirm you want to do so.</p>
<p><input type="text" name="tp_confirm" size="20">
</p><hr />
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Get er done" />
</p>
</form>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment