Skip to content

Instantly share code, notes, and snippets.

Created August 30, 2017 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/43b68dece3b7c33942bd8809646ebf0c to your computer and use it in GitHub Desktop.
Save anonymous/43b68dece3b7c33942bd8809646ebf0c to your computer and use it in GitHub Desktop.
function clean_commerce_site_branding() {
?>
<div class="site-branding">
<?php clean_commerce_the_custom_logo(); ?>
<?php $show_title = clean_commerce_get_option( 'show_title' ); ?>
<?php $show_tagline = clean_commerce_get_option( 'show_tagline' ); ?>
<?php if ( true === $show_title || true === $show_tagline ) : ?>
<div id="site-identity">
<?php if ( true === $show_title ) : ?>
<?php if ( is_front_page() && is_home() ) : ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php endif; ?>
<?php endif; ?>
<?php if ( true === $show_tagline ) : ?>
<p class="site-description"><?php bloginfo( 'description' ); ?></p>
<?php endif; ?>
</div><!-- #site-identity -->
<?php endif; ?>
</div><!-- .site-branding -->
<div id="right-header">
<?php if ( has_nav_menu( 'header' ) ) : ?>
<?php
wp_nav_menu( array(
'theme_location' => 'header',
'container' => 'nav',
'container_id' => 'header-nav',
'depth' => 1,
) );
?>
<?php endif; ?>
<?php if ( clean_commerce_is_woocommerce_active() ) : ?>
<div id="cart-section">
<ul>
<li class="account-login">
<a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>"><?php echo is_user_logged_in() ? esc_html__( 'My Account', 'clean-commerce' ) : esc_html__( 'Login / Register', 'clean-commerce' ) ; ?></a>
</li>
<li class="cart-price"><a href="<?php echo esc_url( wc_get_cart_url() ); ?>"><strong><?php esc_html_e( 'Change the text', 'clean-commerce' ) ?></strong>&nbsp;/&nbsp;<span class="amount"><?php echo WC()->cart->get_cart_total(); ?></span></a></li>
<li class="cart-icon"><strong><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() );?></strong><span class="cart-icon-handle"></span></li>
</ul>
</div> <!-- .cart-section -->
<?php endif; ?>
</div> <!-- #right-header -->
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment