Return to Snippet

Revision: 46101
at May 13, 2011 06:35 by jamiebrwr


Updated Code
/* Admin Settings Page Warning */
add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen; ?> <div>
     <?php if ( $current_screen->parent_base == 'options-general' )
          echo '<div style="background-color:lightYellow;padding:10px;margin-top:20px;border-width:1px;border-style: solid;border-color:#E6DB55;padding: 0 .6em;margin: 5px 15px 2px;-moz-border-radius: 3px;-khtml-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;"><p>Warning - changing settings on these pages may cause problems with your website\'s design!</p></div>';
}

Revision: 46100
at May 13, 2011 06:32 by jamiebrwr


Updated Code
/* Admin Settings Page Warning */
add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen; ?> <div>
     <?php if ( $current_screen->parent_base == 'options-general' )
          echo '<div style="background-color:lightYellow;border-color:1px solid #E6DB55;padding:10px;margin-top:20px;"><p>Warning - changing settings on these pages may cause problems with your website\'s design!</p></div>';
}

Revision: 46099
at May 13, 2011 01:03 by jamiebrwr


Updated Code
/* Admin Settings Page Warning */
add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen; ?> <div>
     <?php if ( $current_screen->parent_base == 'options-general' )
          echo '<div style="background:#fbf9ca;padding:10px;"><p>Warning - changing settings on these pages may cause problems with your website\'s design!</p></div>';
}

Revision: 46098
at May 13, 2011 01:02 by jamiebrwr


Updated Code
/* Admin Settings Page Warning */
add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen; ?> <div>
     <?php if ( $current_screen->parent_base == 'options-general' )
          echo '<div style="background:#fbf9ca;padding:10px;"><p>Warning - changing settings on these pages may cause problems with your website\'s design!</p></div>';
}

/* Custom news feed on the dashboard */
add_action('wp_dashboard_setup', 'my_dashboard_widgets');
function my_dashboard_widgets() {
     global $wp_meta_boxes;
     // remove unnecessary widgets
     // var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs
     unset(
          $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']
     );
     // add a custom dashboard widget
     wp_add_dashboard_widget( 'dashboard_custom_feed', 'News from The Wall Street Journal', 'dashboard_custom_feed_output' ); //add new RSS feed output
}
function dashboard_custom_feed_output() {
     echo '<div class="rss-widget">';
     wp_widget_rss_output(array(
          'url' => 'http://online.wsj.com/xml/rss/3_7011.xml',
          'title' => 'What\'s up at 10up',
          'items' => 2,
          'show_summary' => 1,
          'show_author' => 0,
          'show_date' => 1,
     ));
     echo "</div>";
}

Revision: 46097
at May 13, 2011 00:01 by jamiebrwr


Initial Code
add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen; ?> <div>
     <?php if ( $current_screen->parent_base == 'options-general' )
          echo '<div><p>Warning - changing settings on these pages may cause problems with your website\'s design!</p></div>';
}

Initial URL
http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/

Initial Description
Clients often expect full administrative access (and rightly so), including access to settings pages. Let’s look at how we can hook admin “notices” (those warning boxes generated by some plug-ins) to send some warnings to administrative users when they are on settings pages.

Initial Title
Admin Warning Notice

Initial Tags
wordpress

Initial Language
PHP