SixRsh_Phone::to_wa_me( $phone ), 'greeting' => $widget['greeting'] ?? __( 'Chat with us on WhatsApp', '6rsh-messaging-notifications' ), 'prefill' => $widget['prefill'] ?? __( 'Hello! I have a question about...', '6rsh-messaging-notifications' ), 'position' => $widget['position'] ?? 'right', 'color' => $widget['color'] ?? '#25D366', 'delay' => (int) ( $widget['delay'] ?? 3 ), 'hide_mobile' => ! empty( $widget['hide_mobile'] ), 'show_on' => $widget['show_on'] ?? 'all', ) ); } catch ( \Throwable $e ) { error_log( '[6rsh WhatsApp] Widget::enqueue_widget_assets exception: ' . $e->getMessage() ); } } /** * Output the placeholder div that widget.js will populate. * * @return void */ public static function render_widget_placeholder(): void { try { $settings = get_option( 'sixrsh_settings', array() ); if ( empty( $settings['widget']['enabled'] ) ) { return; } echo '
' . "\n"; } catch ( \Throwable $e ) { error_log( '[6rsh WhatsApp] Widget::render_widget_placeholder exception: ' . $e->getMessage() ); } } /** * Determine whether the widget should render on the current page. * * @param string $show_on Setting value: 'all', 'shop-product', or 'home'. * * @return bool */ private static function should_show( string $show_on ): bool { if ( 'all' === $show_on ) { return true; } if ( 'home' === $show_on ) { return is_front_page() || is_home(); } if ( 'shop-product' === $show_on ) { return is_shop() || is_product() || is_product_category() || is_product_tag(); } return true; } }