elements_empty( 'left' ) ) : ?>
render_components( 'left' ); ?>
elements_empty( 'right' ) ) : ?>
render_components( 'right' ); ?>
get_topbar_components( $location ); if( count( $components ) === 0 ) { return true; } return false; } /** * Render header components */ public function render_components( $location ) { $components = $this->get_topbar_components( $location ); if( has_nav_menu( 'top-bar-mobile' ) ) { array_splice( $components, array_search( 'secondary_nav', $components, true ), 0, 'secondary_nav_mobile' ); } foreach ( $components as $component ) { call_user_func( array( $this, $component ) ); } } /** * Get column class */ public function get_column_class( $location ) { $center_content = get_theme_mod( 'center_top_bar_contents', 0 ); if( 'left' === $location ) { $components = $this->get_topbar_components( 'right' ); } if( 'right' === $location ) { $components = $this->get_topbar_components( 'left' ); } if( count( $components ) === 0 && ! $center_content ) { if( 'right' === $location ) { return 'col-12 justify-content-end'; } return 'col-12'; } return 'col'; } /** * Contact info */ public function contact_info() { $email = get_theme_mod( 'topbar_contact_mail', esc_html__( 'office@example.org', 'botiga' ) ); $phone = get_theme_mod( 'topbar_contact_phone', esc_html__( '111222333', 'botiga' ) ); ?>
'; botiga_social_profile( 'social_profiles_topbar' ); echo ''; } /** * Secondary menu */ public function secondary_nav() { if ( function_exists('max_mega_menu_is_enabled') && max_mega_menu_is_enabled( 'secondary' ) ) : ?> 'secondary' ) ); ?> '; echo wp_kses_post( $topbar_html_content ); echo ''; } /** * Shortcode */ public function shortcode() { $topbar_shortcode_content = get_theme_mod( 'topbar_shortcode_content', '' ); if( ! $topbar_shortcode_content ) { return ''; } echo '
'; echo do_shortcode( $topbar_shortcode_content ); echo '
'; } /** * Login/Register */ public function login_register() { $output = ''; if( ! class_exists( 'Woocommerce' ) ) { return ''; } if( is_user_logged_in() ) { $show_welcome_message = get_theme_mod( 'login_register_show_welcome_message', 1 ); if( ! $show_welcome_message ) { return; } $current_user = wp_get_current_user(); /* translators: 1: display name. */ $welcome_message_text = get_theme_mod( 'login_register_welcome_message_text', sprintf( esc_html__( 'Welcome %s', 'botiga' ), '{display_name}' ) ); $welcome_message_text = str_replace( array( '{user_firstname}', '{user_lastname}', '{user_email}', '{user_login}', '{display_name}' ), array( $current_user->user_firstname, $current_user->user_lastname, $current_user->user_email, $current_user->user_login, $current_user->display_name ), $welcome_message_text ); $output .= '' . esc_html( $welcome_message_text ) . ''; $output .= ''; } else { $login_register_link_text = get_theme_mod( 'login_register_link_text', esc_html__( 'Login', 'botiga' ) ); $login_register_popup = Botiga_Modules::is_module_active( 'login-popup' ); $link_classes = array( 'botiga-login-register-link' ); if( $login_register_popup ) { $link_classes[] = 'has-popup'; } $output .= ''. esc_html( $login_register_link_text ) .''; } echo '
'; echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- previously escaped echo '
'; } } /** * Initialize class */ Botiga_Top_Bar::get_instance(); endif;