Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.