diff --git a/admin/class-hfe-addons-actions.php b/admin/class-hfe-addons-actions.php index 2cf780736..36eea9183 100644 --- a/admin/class-hfe-addons-actions.php +++ b/admin/class-hfe-addons-actions.php @@ -71,6 +71,8 @@ public function __construct() { add_action( 'wp_ajax_hfe_flush_permalink_notice', [ $this, 'hfe_flush_permalink_notice' ] ); add_action( 'wp_ajax_nopriv_hfe_flush_permalink_notice', [ $this, 'hfe_flush_permalink_notice' ] ); + add_action( 'wp_ajax_dismiss_sticky_header_notice', [ $this, 'dismiss_sticky_header_notice' ] ); + } /** @@ -572,6 +574,24 @@ public function save_analytics_option() { } } + /** + * Handle sticky header notice dismissal + * + * @return void + */ + public function dismiss_sticky_header_notice() { + if (!wp_verify_nonce($_POST['nonce'], 'hfe_dismiss_sticky_header_notice')) { + wp_die('Security check failed'); + } + + if ( ! current_user_can( 'manage_options' ) ) { + wp_send_json_error( 'Unauthorized', 403 ); + } + + update_user_meta(get_current_user_id(), 'uae_sticky_header_notice_dismissed', true); + wp_send_json_success(); + } + } /** diff --git a/inc/class-header-footer-elementor.php b/inc/class-header-footer-elementor.php index 1ff6c64f7..3d589c557 100644 --- a/inc/class-header-footer-elementor.php +++ b/inc/class-header-footer-elementor.php @@ -92,6 +92,11 @@ function () { 'in_admin_header', function () { $this->render_admin_top_bar(); + $current_screen = get_current_screen(); + if( 'edit-elementor-hf' === $current_screen->id ){ + // Add sticky header promotion notice for elementor-hf listing page + $this->sticky_header_promotion_notice(); + } } ); } @@ -368,6 +373,144 @@ public function elementor_outdated() { printf( '

%2$s

%3$s
', esc_attr( $class ), wp_kses_post( $message ), wp_kses_post( $button ) ); } + /** + * Check if user has headers created with HFE + * + * @return boolean + */ + private function has_hfe_headers() { + $headers = get_posts(array( + 'post_type' => 'elementor-hf', + 'meta_query' => array( + array( + 'key' => 'ehf_template_type', + 'value' => 'type_header', + 'compare' => '=' + ) + ), + 'posts_per_page' => 1, + 'post_status' => 'publish' + )); + + return !empty($headers); + } + + /** + * Check if sticky header promotion notice should be shown + * + * @return boolean + */ + private function should_show_sticky_header_notice() { + // Don't show if already dismissed + if (get_user_meta(get_current_user_id(), 'uae_sticky_header_notice_dismissed', true)) { + return false; + } + + // Don't show if pro version is already active + if (defined('UAEL_PRO') && UAEL_PRO) { + return false; + } + + // Only show if user has HFE headers + $has_headers = $this->has_hfe_headers(); + + // Debug: Uncomment the line below to force show the notice for testing + // return true; + + return $has_headers; + } + + /** + * Display sticky header promotion notice + * + * @return void + */ + public function sticky_header_promotion_notice() { + if (!$this->should_show_sticky_header_notice()) { + return; + } + + $this->render_sticky_header_notice(); + } + + /** + * Render the sticky header promotion notice HTML + * + * @return void + */ + private function render_sticky_header_notice() { + + ?> +
+
+
+ UAE Logo +
+
+

+ +

+

+ Ultimate Addons for Elementor to create custom headers. + Take it to the next level with Sticky Header functionality in UAE Pro! + Keep your navigation visible as users scroll for better user experience and higher conversions.", + 'header-footer-elementor' + ) ); + ?> +

+
+ + + + + + +
+
+
+
+ + +