/i', $post->post_content, $matches); $first_img = $matches [1] [0]; // no image found display default image instead if(empty($first_img)){ $first_img = "/images/default.jpg"; } return $first_img; } $options = array( array( "name" => "Homepage Banner Settings", "id" => "imgurl", "imgdesc" =>"Insert URL for image file location"), array( "id" => "linkurl", "urldesc" =>"Insert URL to page where people are sent after clicking banner"), array( "id" => "banchkb", "bantitle" =>"Show Banner On Home Page"), ); function mt_add_pages() { global $options; if ('theme_save'== $_REQUEST['action'] ) { foreach ($options as $value) { if( !isset( $_REQUEST[ $value['id'] ] ) ) { } else { update_option( $value['id'], stripslashes($_REQUEST[ $value['id']])); } } if(stristr($_SERVER['REQUEST_URI'],'&saved=true')) { $location = $_SERVER['REQUEST_URI']; } else { $location = $_SERVER['REQUEST_URI'] . "&saved=true"; } header("Location: $location"); die; } add_menu_page('admin-menu', 'Theme Options', 5, __FILE__, 'mt_toplevel_page'); } // mt_oplevel_page() displays the page content for the custom Test Toplevel menu function mt_toplevel_page() { global $options; echo '

Black Pearl Theme Options

'; ?>

Setings Saved









On /> Off />

'; } add_action('admin_menu', 'mt_add_pages'); ?>