Info-banner for the header

function add_header_banner_admin_page(){
	add_menu_page('Banner','Banner', 'manage_options', 'header-banner-admin-page', 'header_banner_admin_page', '', 10);
}

function header_banner_admin_page(){
?>
	<div class='wrap'> 
	<h2>Header Banner Page</h2>
	<form method='post'>
	<?php 
		wp_nonce_field('header_banner_nonce_action', 'header_banner_nonce_field');
		
		$content = get_option('special_content');
		//wp_editor( $content, 'special_content' );
		wp_editor( stripslashes( $content ), strtolower('special_content') );
		
		submit_button('Save', 'primary');
	?>
	</form>
	</div><!-- .wrap -->
<?php
}

function save_add_header_banner_menu_page(){
	// check the nonce, update the option etc...
	if( isset($_POST['header_banner_nonce_field']) && check_admin_referer('header_banner_nonce_action', 'header_banner_nonce_field')){
		
		if(isset($_POST['special_content'])){
			update_option('special_content', $_POST['special_content']);
		}
	}
}

add_action('admin_menu', 'add_header_banner_admin_page');
add_action('admin_init', 'save_add_header_banner_menu_page', 10);

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

© 2020 Jakob Helmer - Powered by WordPress - @trails&tribulations