id == 'appearance_page_newstoday-doc' ) { return; } $theme_data = wp_get_theme(); echo '
'; echo '

'; /* translators: %s theme name */ printf( esc_html__( 'Welcome to %s', 'newstoday' ), esc_html( $theme_data->Name ) ); echo '

'; echo '

'; /* translators: %1$s: theme name, %2$s link */ printf( __( 'Thank you for choosing %1$s! To fully take advantage of the best our theme can offer please make sure you visit our Welcome page', 'newstoday' ), esc_html( $theme_data->Name ), esc_url( admin_url( 'themes.php?page=newstoday-doc' ) ) ); echo '

'; echo '

'; /* translators: %s theme name */ printf( esc_html__( 'Get started with %s', 'newstoday' ), esc_html( $theme_data->Name ) ); echo '

'; echo '
'; } /** * Display custom admin notice for the recommended number of posts per archive page. * * @since Newstoday 1.0.3 */ // update_user_meta( get_current_user_id(), 'newstoday_admin_notice_postsnum', 'no' ); function newstoday_admin_notice_postsnum() { if ( !current_user_can('edit_theme_options') ) { return; } // Bail if the user has previously dismissed the notice (doesn't show the notice) if ( get_user_meta( get_current_user_id(), 'newstoday_admin_notice_postsnum', true ) === 'dismissed' ) { return; } $newstoday_option_posts_per_page = get_option( 'posts_per_page' ); if ( $newstoday_option_posts_per_page % 2 == 0 ) { return; } $current_user = wp_get_current_user(); ?>

Reading, Link to Theme About Page */ __( '%1$s, your website is set up to display %2$s posts per page, but Newstoday Theme works best with even numbers, as it displays posts in a grid of 2 (by default).
We recommend going to Settings > Reading and changing the Blog pages show at most value to an even number: 2, 4, 6, 8, 10, etc.', 'newstoday' ), $current_user->display_name, $newstoday_option_posts_per_page, esc_url( admin_url( 'options-reading.php' ) ), esc_url( admin_url( 'themes.php?page=newstoday-doc' ) ) ); ?>

wp_create_nonce( 'newstoday_admin_notice_nonce' ), )); } } add_action( 'admin_enqueue_scripts', 'newstoday_enqueue_admin_scripts' ); /** * Process the AJAX request on the server and send a response back to the JS. * If nonce is valid, update the current user's meta to prevent notice from displaying. */ function newstoday_dismiss_admin_notice_postsnum() { // Verify the security nonce and die if it fails if ( ! isset( $_POST['newstoday_admin_notice_nonce'] ) || ! wp_verify_nonce( $_POST['newstoday_admin_notice_nonce'], 'newstoday_admin_notice_nonce' ) ) { wp_die( __( 'Your request failed permission check.', 'newstoday' ) ); } // Store the user's dimissal so that the notice doesn't show again update_user_meta( get_current_user_id(), 'newstoday_admin_notice_postsnum', 'dismissed' ); // Send success message wp_send_json( array( 'status' => 'success', 'message' => __( 'Your request was processed. See ya!', 'newstoday' ) ) ); } add_action( 'wp_ajax_newstoday_admin_notice_postsnum', 'newstoday_dismiss_admin_notice_postsnum' );