Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to create an "Alert" button that can be turned on and off thru wp-admin. Of course the "Alert" button im asking for is to be published at the main page, but can only be turned on when its needed.

Im using wordpress with jqueryMobile for your information.

EDIT:

Its pretty hard to explain this. But i found this plugin and it does what im after. Except this plugin show the notification on everypage - even wp-admin.

To the question:

Is it possible to create a notification/menubar that can be tunerd on/off from wp-admin. The idea behind this is to show important "news" whenever.?

Whats the best solution?

share|improve this question
1  
I don't understand what the code you posted has to do with the description of what you are trying... If you want like a checkbox in the admin area that will be used to enable/disable something in the frontend, take a look at the Settings API. So, in your template you'd have if(get_option('alert_button')) echo 'Alert!';. –  brasofilo Jan 22 '13 at 14:10
    
Yeah something like that. Lets say i have 4 menu buttons. I want the 5th page just to "be turned on" when i need to it show within the 4 button. Do you understand ? With other words, it will always excist in wp-admin i just need to activate and deactivate control. –  M3o Jan 22 '13 at 15:33
    
Research using the hints I gave and upgrade the Question, what you ask ain't difficult, but that downvote (not mine) clearly indicates the Q needs improvement. –  brasofilo Jan 22 '13 at 17:13
    
Thanks you! Im already lookin in to it. And the question is now updated. –  M3o Jan 23 '13 at 9:23
add comment

1 Answer

up vote 0 down vote accepted

Using the very example from the Codex in the Settings API section. Put it in the theme's functions.php:

add_action('admin_init', 'eg_settings_api_init');

function eg_settings_api_init() {
    add_settings_section(
        'eg_setting_section',
        'Example settings section in reading',
        'eg_setting_section_callback_function',
        'reading'
    );

    add_settings_field(
        'eg_setting_name',
        'Example setting Name',
        'eg_setting_callback_function',
        'reading',
        'eg_setting_section'
    );

    register_setting('reading','eg_setting_name');
}

function eg_setting_section_callback_function() {
    echo '<p>Intro text for our settings section</p>';
}

function eg_setting_callback_function() {
    echo '<input name="eg_setting_name" 
        id="gv_thumbnails_insert_into_excerpt" 
        type="checkbox" 
        value="1" 
        class="code" ' 
        . checked( 1, get_option('eg_setting_name'), false ) 
        . ' />Explanation text';
}

This creates a checkbox in Settings > Reading:
settings api

And in the theme header.php file, it can be used to render a big red warning banner:

<?php 
    if( get_option('eg_setting_name') ) {
        echo '<h1 style="background-color: #fcc;width:100%;height:3em;line-height:3em;text-align:center;top:40px;position:fixed">
            Warning!
            </h1>';
    }
?>
share|improve this answer
    
Thank you for your time , this worked! –  M3o Jan 23 '13 at 13:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.