There are three WordPress functions worth mentioning when working with forms. checked, selected and disabled provide a quick way of setting a checked boxed to checked, an option of a select tag to selected or disabling a field varying the value of the input.
The three functions, fully listed below, compare $checked, $selected or $disabled against $current (which defaults to true) and provides the option to echo the result if $echo is true, or return the result if $echo is false.
checked( $checked, $current = true, $echo = true ); selected( $selected, $current = true, $echo = true ); disabled( $disabled, $current = true, $echo = true );
How To Write an Object Oriented WordPress Plugin
<?php
new My_Functions;
class My_Functions {
/**
* Add your hooks and filters here.
*/
function My_Functions()
{
add_action( 'wp_enqueue_scripts', array(&$this,'wp_enqueue_scripts') );
add_action( 'wp_print_styles', array(&$this,'wp_print_styles') );
} // function
function wp_enqueue_scripts()
{
/**
* Load jQuery if WordPress is displaying a Page
*/
if( is_page() )
wp_enqueue_script( 'jquery' );
} // function
function wp_print_styles()
{
/**
* Load custom css file if WordPress is displaying a Page
*/
wp_register_style('custom', $path_to_custom);
if( is_page() )
wp_enqueue_style( 'custom' );
} // function
} // class
?>