'; $javascript = ' '; echo $style_sheet.$javascript; } } add_action('wp_head', 'announcement_header'); add_action('wp_head', 'insertAnnouncement'); function insertAnnouncement() { if( get_option('announce_active') == 1 && ! isset($_COOKIE['an_displayed']) ) { $plugin_path = get_option('siteurl').'/wp-content/plugins/announcement' ; $template = <<< LAST LAST; echo $template; } } function announcement_install() { // initialize post object $wm_mypost = new wm_mypost(); // fill object $wm_mypost->post_title = "Announcement"; $wm_mypost->post_content = "This is a sample"; $wm_mypost->post_status = 'private'; $wm_mypost->post_author = 1; // Optional; uncomment as needed $wm_mypost->post_type = 'page'; // $wm_mypost->comment_status = 'closed'; // feed object to wp_insert_post $post_id = wp_insert_post($wm_mypost); add_option('announce_id', $post_id , ""); add_option('announce_active', 0,""); update_option('announce_id', $post_id); update_option('announce_active',0); } function announcement_option() { if($_POST['action'] == 'save') { if ( isset( $_POST['active'] ) ) update_option('announce_active',1); else update_option('announce_active',0); } ?>

Announcement Options > >


Your Announcement Plugin is currently Active and Running Inactive
Go to Edit Announcement . Here you and edit and manage your announcement. (No need to publish).
After that check the active checkbox below and save. If you want to stop the announcement, uncheck the checkbox and save. Happy Blogging !!!

Active: checked="true" name="active"/>

Edit Announcement
ID == get_option('announce_id') ) { echo " This is the Page for Announcement Plugin. Edit and Save, No need to publish.
"; $link = get_option('siteurl').'/wp-admin/options-general.php?page=announcement'; echo 'Plugin Settings >>

'; } } add_action('edit_page_form', 'add_suggestion'); ?>