All pastes #15580 Raw Edit

chrisjdavis

public text v1 · immutable
#15580 ·published 2005-06-22 20:05 UTC
rendered paste body
//this goes in header.php, I place it right after the opening require('')
$plugins = get_settings('active_plugins');
if (empty($plugins))
$write_option = true;
foreach ($plugins as $plugin) {
if ($plugin == '../themes/k2/test.php') {
$write_option = false;
break;
}else
$write_option = true;
}
if ($write_option)
{
$plugins[count($plugins)] = '../themes/k2/test.php';
update_option('active_plugins', $plugins);
}

//and this is your plugin file:
<?php
/*
Plugin Name: K2 Options Panel
Plugin URI: http://binarybonsai.com/k2/
Description: Installs an option panel for the K2 theme.
Version: 1.0 alpha
Author: Michael Heilemann
Author URI: http://binarybonsai.com
*/


// This section installs the plugin, quite deviously.
// Code supplied by Turnip: http://binarybonsai.com/archives/2005/06/03/k2-options-panel/#comment-14748 - moved to header.php

// Let's add the options page.
add_action ('admin_menu', 'k2menu');

function k2menu() {
	// the first option is for what page this will be off
    add_options_page('K2', 'K2 Options', 5, __FILE__, 'menu');
}

function menu() {
load_plugin_textdomain('k2options');
//this begins the admin page
?>
<div class="wrap">
<h2><?php _e('K2 Options'); ?></h2>
<?php
echo "hey, how are ya?";
?>
</div>
<?php
} // this ends the admin page
?>