Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Fixed issues with logo
Browse files Browse the repository at this point in the history
  • Loading branch information
rodica-andronache committed Sep 19, 2016
1 parent 67b3991 commit b218805
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 40 deletions.
19 changes: 12 additions & 7 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,18 @@
<div class="overlay"></div>
<div class="container">
<div class="site-branding">
<?php if ( ( get_theme_mod('site_logo') && get_theme_mod('logo_style', 'hide-title') == 'hide-title' ) || is_customize_preview() ) : //Show only logo ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="<?php echo !get_theme_mod('site_logo') && is_customize_preview() ? " oblique-only-customizer" : ""; ?>" title="<?php echo esc_attr(get_bloginfo('name')); ?>"><img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" /></a>
<?php endif; ?>

<?php if ( !get_theme_mod('site_logo') || get_theme_mod('logo_style', 'show-title') == 'show-title' || is_customize_preview() ) : ?>
<h1 class="site-title<?php echo get_theme_mod('logo_style', 'show-title') == 'hide-title' && is_customize_preview() && get_theme_mod('site_logo') ? " oblique-only-customizer" : ""; ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description<?php echo get_theme_mod('logo_style', 'show-title') == 'hide-title' && is_customize_preview() && get_theme_mod('site_logo') ? " oblique-only-customizer" : ""; ?>"><?php bloginfo( 'description' ); ?></h2>
<?php $oblique_site_logo = get_theme_mod('site_logo'); ?>
<?php if ( !empty($oblique_site_logo) && get_theme_mod('logo_style', 'hide-title') == 'hide-title' ) : //Show only logo ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr(get_bloginfo('name')); ?>"><img class="site-logo" src="<?php echo esc_url($oblique_site_logo); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" /></a>
<?php elseif ( get_theme_mod('logo_style', 'hide-title') == 'show-title' ) : ?>
<?php if( !empty($oblique_site_logo) ) { ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr(get_bloginfo('name')); ?>"><img class="site-logo show-title" src="<?php echo esc_url($oblique_site_logo); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" /></a>
<?php }?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
<?php else: //Show only site title and description ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
<?php endif; ?>
</div><!-- .site-branding -->
</div>
Expand Down
5 changes: 1 addition & 4 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public function render_content() {
'site_logo',
array(
'default-image' => '',
'sanitize_callback' => 'esc_url_raw',
'transport' => 'postMessage'

'sanitize_callback' => 'esc_url_raw'
)
);
$wp_customize->add_control(
Expand Down Expand Up @@ -139,7 +137,6 @@ public function render_content() {
array(
'default' => 'hide-title',
'sanitize_callback' => 'oblique_sanitize_logo_style',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
Expand Down
29 changes: 0 additions & 29 deletions js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,35 +170,6 @@
} );
});

// Logo - Header
wp.customize( 'site_logo', function( value ) {
value.bind( function( val ) {
var logo = $( '.site-logo' ),
logo_wrap = $( '.site-branding > a' ),
title = $( '.site-branding .site-title, .site-branding .site-description' );

logo.attr( 'src', val );
if( '' !== val ) {
logo_wrap.removeClass( 'oblique-only-customizer' );
} else {
logo_wrap.addClass( 'oblique-only-customizer' );
}
} );
});

// Logo style - Header
wp.customize( 'logo_style', function( value ) {
value.bind( function( val ) {
var title = $( '.site-branding .site-title, .site-branding .site-description' ),
logo_wrap = $( '.site-branding > a' );
if( 'hide-title' === val && !logo_wrap.hasClass( 'oblique-only-customizer' ) ) {
title.addClass( 'oblique-only-customizer' );
} else {
title.removeClass( 'oblique-only-customizer' );
}
} );
});

// Padding - Header
wp.customize( 'branding_padding', function( value ) {
value.bind( function( val ) {
Expand Down

0 comments on commit b218805

Please sign in to comment.