is_dismissed = (bool) $dismissed; if ( ! empty( $ga_id ) ) { $this->is_dismissed = true; } // Don't bother setting anything else up if we are not going to show the notice if ( true === $this->is_dismissed ) { return; } add_action( 'admin_notices', array( $this, 'banner' ) ); add_action( 'admin_init', array( $this, 'dismiss_banner' ) ); } /** * Displays an info banner on WooCommerce settings pages */ public function banner() { $screen = get_current_screen(); if ( ! in_array( $screen->base, array( 'woocommerce_page_wc-settings', 'plugins' ) ) || $screen->is_network || $screen->action ) { return; } $integration_url = esc_url( admin_url( 'admin.php?page=wc-settings&tab=integration§ion=google_analytics' ) ); $dismiss_url = $this->dismiss_url(); $heading = __( 'Google Analytics & WooCommerce', 'woocommerce-google-analytics-integration' ); $configure = sprintf( __( 'Connect WooCommerce to Google Analytics to finish setting up this integration.', 'woocommerce-google-analytics-integration' ), $integration_url ); // Display the message.. echo '
' . $heading . ' '; echo ' ' . __( '(Dismiss)', 'woocommerce-google-analytics-integration' ) . ''; echo '
' . $configure . "