Edit: px_notice.php
<?php // Exit if accessed directly for security if (!defined('ABSPATH')) { exit; } // Hook to display admin notice add_action('admin_notices', 'px_theme_activation_notice'); function px_theme_activation_notice() { // Check if welcome notice should be shown if (!get_transient('px_theme_show_welcome_notice')) { return; } // Get current admin screen $screen = get_current_screen(); // Only show on dashboard or themes page if (!$screen || !in_array($screen->id, array('dashboard', 'themes'))) { return; } // Define banner image path $bg_image = get_template_directory_uri() . '/assets/img/dashboard/PIXEL-banner-dashboard.jpg'; // Plugin file path to check installation/activation $target_plugin_file = 'pixel-starter-templates/pixel-starter-templates.php'; // Include plugin functions if not already loaded if (!function_exists('is_plugin_active')) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } // Check if plugin is installed $installed = file_exists(WP_PLUGIN_DIR . '/' . $target_plugin_file); // If plugin is installed and active, remove notice if ($installed && is_plugin_active($target_plugin_file)) { delete_transient('px_theme_show_welcome_notice'); return; } // Create security nonce for AJAX $nonce = wp_create_nonce('px_plugin_nonce'); ?> <!-- Main Notice Wrapper --> <div class="px-overview"> <div class="px-overview-content"> <!-- LEFT SIDE CONTENT --> <div class="px-overview-content__left"> <ul> <li> <!-- Icon Section --> <div class="px-icon"> <div class="et-common-icon et-common-icon--layers" style="fill: rgb(255, 255, 255); width: 55px;padding-right: 7px;"> <svg viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" shape-rendering="geometricPrecision"> <g> <path d="M13.4335 16.6105C13.7747 16.8451 14.2253 16.8451 14.5665 16.6105L20.8014 12.324C21.3794 11.9267 21.3794 11.0733 20.8014 10.676L14.5665 6.38949C14.2253 6.15488 13.7747 6.15488 13.4335 6.38949L7.19861 10.676C6.62064 11.0733 6.62064 11.9267 7.19861 12.324L13.4335 16.6105Z" stroke="#7E3BD0" stroke-width="2"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M17.7555 14.5763L19.9723 16.1598L20.5536 16.9735L14 20.4258L8.02766 16.1598L7.44642 15.3461L10.2445 14.5763L8.52408 13.3474L6.86518 14.5323C5.74849 15.33 5.74848 16.9896 6.86518 17.7873L12.8375 22.0532C13.5329 22.5499 14.4671 22.5499 15.1625 22.0532L21.1348 17.7873C22.2515 16.9896 22.2515 15.33 21.1348 14.5323L19.4759 13.3474L17.7555 14.5763Z" fill="#7E3BD0"></path> </g> </svg> </div> </div> <!-- Welcome Heading --> <h1 class="px-notice_overview-header"> <?php esc_html_e('Welcome To ' . PX_THEMENAME . ' Child Theme!', 'pxtheme'); ?> </h1> </li> <!-- Divider --> <li><span class="px-dashboard-devider"></span></li> <!-- Theme Description --> <li> <div> <?php esc_html_e(PX_THEMEDESC . ' Child Theme', 'pxtheme'); ?> </div> </li> <!-- Support Text --> <li> <p style="text-align:left"> We know what it's like to need support. This is the reason why our customers are the top priority and we treat every issue with the utmost seriousness. The team is working hard to help every customer, keep documentation updated, produce tutorials, and improve usability. </p> </li> <?php // Initialize installer button variables $show_installer_btn = true; $installer_url = ''; // Check if installer has not been completed if (get_option('diet_installer_completed') !== get_stylesheet()) { // Check if installer exists in theme directory if (file_exists(get_stylesheet_directory() . '/diet-installer/bootstrap.php')) { $show_installer_btn = true; $installer_url = admin_url('admin.php?page=diet-installer'); } } ?> <!-- Top Buttons Section --> <div class="px-top-btn"> <!-- Support Message --> <strong> <div class="px_feedback"> If You Have Any Questions? <a href="<?php esc_html_e(PX_SUPPORT_URL); ?>" target="_blank">Let Us Know !!</a> </div> </strong> <!-- Import Button --> <?php if ($show_installer_btn) : ?> <div class="px_notice_top_btn"> <a class="et-common-button button-primary" href="<?php echo esc_url($installer_url); ?>"> <?php esc_html_e('Start Import →', 'pxtheme'); ?> </a> </div> <?php endif; ?> <!-- Contact Buttons --> <li class="px-et-button"> <a class="et-common-button" href="mailto:<?php esc_html_e(PX_SUPPORT_EMAIL); ?>" target="_blank">Email Us</a> <a class="et-common-button" href="<?php esc_html_e(PX_WHATSUP_EMAIL); ?>" target="_blank">Talk on WhatsApp</a> <a class="et-common-button" href="<?php esc_html_e(PX_SUPPORT_URL); ?>" target="_blank">Open Ticket</a> </li> </div> </ul> </div> <!-- RIGHT SIDE CONTENT --> <div class="px-overview-content__right"> <ul> <li style="position:relative;"> <!-- Theme Screenshot --> <img src="<?php esc_html_e(get_stylesheet_directory_uri() . '/screenshot.jpg'); ?>" style="border-radius:10px;width: 100%;" /> <!-- Version Label --> <span class="px-version"> <?php esc_html_e('Version ', 'pxtheme'); ?> <?php esc_html_e(PX_VERSION); ?> </span> </li> </ul> </div> </div> </div> <?php } // AJAX handler to dismiss notice add_action('wp_ajax_px_dismiss_welcome_notice', 'px_dismiss_welcome_notice_handler'); function px_dismiss_welcome_notice_handler() { // Verify nonce for security check_ajax_referer('px_dismiss_nonce', '_ajax_nonce'); // Capability check (only users who can manage theme options) if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error( array( 'message' => 'Insufficient permissions.' ) ); } // Delete transient to hide notice permanently delete_transient('px_theme_show_welcome_notice'); // Return success response wp_send_json_success(); }
Save
Back