[wp-hackers] Need help with: coding new Plugin options

Daiv Mowbray daiv at daivmowbray.com
Fri Nov 7 08:13:45 GMT 2008

Great tips here guys, thanx,
After reading numerous plugins, trying to determine what is the
best practice for writing a plugin,
I have learnt that there is no standard.
It seams that every one does it different from the next.
It would be great to find a template for standardizing best practice.
The wizard at wp-fun was a god place for me to start,
but it doesn't go far enough.

The codex examples are simple case and incomplete.

A plugin template would be a great tool for standardizing.
I have found suggestions such as the following, which I think are  
great ideas:

add_action('in_admin_footer', 'myplugin_admin_footer', 11 );
function myplugin_admin_footer() {
				$plugin_data = get_plugin_data( __FILE__ );
				printf('%1$s plugin | Version %2$s | by %3$s<br />',  
$plugin_data['Title'], $plugin_data['Version'], $plugin_data['Author']);

* Add link to options page from plugin list.

			function filter_plugin_actions($links, $file) {
   				 static $this_plugin;
    					if( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__);

   				if( $file == $this_plugin ){
   					$settings_link = '<a href="options-general.php? 
    					array_unshift( $links, $settings_link ); // before other links
    				return $links;

On Nov 7, 2008, at 8:58 AM, Ozh wrote:

>> <input type="text" name="my-plugin[field-1]" value="" />
>> <input type="text" name="my-plugin[field-2]" value="" />
>> <input type="text" name="my-plugin-admin[field-1]" value="" />
>> would end up with 2 options, 'my-plugin', and 'my-plugin-admin',  
>> both being
>> arrays, with the keys 'field-xx'
> Pretty obvious, why didn't I think about this ? :)

Daiv Mowbray
daiv at daivmowbray.com

More information about the wp-hackers mailing list