Display a Notice that can be Dismissed after Theme Activation
<?php
function ccd_admin_notice() {
global $current_user;
$user_id = $current_user->ID;
if ( ! get_user_meta( $user_id, 'ignore_notice' ) ) {
echo '<div class="updated"><p>';
printf( __( 'Thanks for choosing our theme! Please use the <strong><a href="' . get_admin_url() . 'customize.php' . '">theme customizer</a></strong> to customize your theme.' ), '?nag_ignore=0' );
echo '</p></div>';
}
}
add_action( 'admin_notices', 'ccd_admin_notice' );
function ccd_nag_ignore() {
global $current_user;
$user_id = $current_user->ID;
if ( isset( $_GET['nag_ignore']) && '0' == $_GET['nag_ignore'] ) {
add_user_meta( $user_id, 'ignore_notice', 'true', true );
}
}
add_action( 'admin_init', 'ccd_nag_ignore' );
?>
WordPress Snippet