Skip to content

Instantly share code, notes, and snippets.

@derpixler
Created August 29, 2011 12:45
Show Gist options
  • Save derpixler/1178316 to your computer and use it in GitHub Desktop.
Save derpixler/1178316 to your computer and use it in GitHub Desktop.
Create a Wordpress Plugin option page in the plugin page.
<?php
/**
* Plugin Name: Plugin Options
* Description: Jo Fetzt wa?
* Version: 0.88
* Author: René Reimann
*/
add_filter( 'plugin_action_links_plugin-options.php', 'po_plugin_action_links', 10, 3 );
add_filter('after_plugin_row_plugin-options.php','po_row_meta',10, 3);
function po_row_meta($plugin_file, $plugin_data, $status){
echo '<tr id="po_options_tr" style="display: none;"><td colspan="4">
<script>
jQuery(document).ready(function(){
var po_options = jQuery("#po_options");
var po_options_tr = jQuery("#po_options_tr");
jQuery("#po_options_switch").click( function(e){
e.preventDefault();
var display_r = po_options_tr.attr("style");
if(!display_r){
po_options.slideToggle( function (){ po_options_tr.attr("style","display:none");});
}else{
po_options_tr.show();
po_options.slideToggle();
}
});
});
</script>
<div id="po_options" style="display:none">';
var_dump($plugin_file, $plugin_data, $status);
echo '</div></td></tr>';
}
function po_plugin_action_links($array){
$array['opdtions'] = '<a href="#" id="po_options_switch">Einstellungen</a>';
return $array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment