Skip to content

Instantly share code, notes, and snippets.

@josephdickson
Created November 5, 2019 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephdickson/f085ffb926c9ea9a9ff9e804594383eb to your computer and use it in GitHub Desktop.
Save josephdickson/f085ffb926c9ea9a9ff9e804594383eb to your computer and use it in GitHub Desktop.
WP dashboard notification sample for functions.php
// Place admin message about the Carousel Video and Carousel categories
function pz_carousel_admin_notice() {
if ( is_admin() ) {
if ( in_category('Carousel Video') ) {
$class = 'video-carousel-notice notice notice-info is-dismissible';
$message = __( 'Video Carousel posts are ordered by most recently updated to least. They display on the homepage', 'sample-text-domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
if ( in_category('Carousel') ) {
$class = 'slide-carousel-notice notice notice-info is-dismissible';
$message = __( 'Carousel posts are ordered by most recently updated to least. They display on the homepage', 'sample-text-domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
}
}
add_action( 'admin_notices', 'pz_carousel_admin_notice' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment