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

Commit

Permalink
Merge pull request #43 from Codeinwp/development
Browse files Browse the repository at this point in the history
Fixed issue with slow loading of posts with masonry
Fixed issue with fonts options in Customize not working in Firefox
Fixed posts order
Update tags
Small improvements in Customize, to better interaction with the user
Added an upsell in Customize
  • Loading branch information
rodica-andronache authored Sep 19, 2016
2 parents 0eeb5d2 + b218805 commit 579435a
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 40 deletions.
11 changes: 10 additions & 1 deletion css/customizer.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@
.customizer-review-link span {
font-size: 12px;
width: 12px;
}
}

#accordion-section-oblique_extra_options .accordion-section-title {
background-image:url(../images/gray-lines.png);
background-repeat:repeat;
}

#accordion-section-oblique_extra_options .accordion-section-title:after {
content: "\f160";
}
40 changes: 22 additions & 18 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@

<?php $menu_text = get_theme_mod('menu_text'); ?>
<div class="sidebar-toggle">
<?php if (!$menu_text) : ?>
<i class="fa fa-bars"></i>
<?php else : ?>
<?php echo esc_html($menu_text); ?>
<?php if( !$menu_text || is_customize_preview() ) : ?>
<i class="fa fa-bars<?php echo $menu_text && is_customize_preview() ? " oblique-only-customizer" : ""; ?>"></i>
<?php endif; ?>
<?php if( $menu_text || is_customize_preview() ) : ?>
<?php echo '<span class="' . (!$menu_text && is_customize_preview() ? " oblique-only-customizer" : "" ) . '">' . esc_html($menu_text) . '<span>'; ?>
<?php endif; ?>
</div>

<div class="top-bar container">
Expand All @@ -41,10 +42,10 @@
<?php wp_nav_menu( array( 'theme_location' => 'social', 'link_before' => '<span class="screen-reader-text">', 'link_after' => '</span>', 'menu_class' => 'menu clearfix', 'fallback_cb' => false ) ); ?>
</nav>
<?php endif; ?>
<?php if ( get_theme_mod('search_toggle') ) : ?>
<div class="header-search">
<?php get_search_form(); ?>
</div>
<?php if ( !get_theme_mod('search_toggle') || is_customize_preview() ) : ?>
<div class="header-search<?php echo get_theme_mod('search_toggle') && is_customize_preview() ? " oblique-only-customizer" : ""; ?>">
<?php get_search_form(); ?>
</div>
<?php endif; ?>
</div>

Expand All @@ -55,16 +56,19 @@
<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' ) : //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(get_theme_mod('site_logo')); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" /></a>
<?php elseif ( get_theme_mod('logo_style', 'hide-title') == 'show-title' ) : //Show logo, site-title, site-description ?>
<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(get_theme_mod('site_logo')); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" /></a>
<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; ?>
<?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>
<div class="svg-container header-svg svg-block">
Expand Down
Binary file added images/gray-lines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 37 additions & 16 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@


function oblique_customize_register( $wp_customize ) {
class Oblique_Theme_Support extends WP_Customize_Control {
public function render_content() {
}
}

$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->remove_control( 'header_textcolor' );
Expand Down Expand Up @@ -45,6 +50,7 @@ public function render_content() {
array(
'sanitize_callback' => 'oblique_sanitize_checkbox',
'default' => 0,
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
Expand All @@ -62,6 +68,7 @@ public function render_content() {
'menu_text',
array(
'sanitize_callback' => 'oblique_sanitize_text',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
Expand All @@ -87,8 +94,7 @@ public function render_content() {
'site_logo',
array(
'default-image' => '',
'sanitize_callback' => 'esc_url_raw',

'sanitize_callback' => 'esc_url_raw'
)
);
$wp_customize->add_control(
Expand Down Expand Up @@ -123,7 +129,6 @@ public function render_content() {
'min' => 50,
'max' => 600,
'step' => 5,
'style' => 'margin-bottom: 15px; padding: 15px;',
),
) );
//Logo style
Expand Down Expand Up @@ -154,6 +159,7 @@ public function render_content() {
array(
'sanitize_callback' => 'absint',
'default' => '150',
'transport' => 'postMessage',
)
);
$wp_customize->add_control( 'branding_padding', array(
Expand All @@ -166,7 +172,6 @@ public function render_content() {
'min' => 20,
'max' => 350,
'step' => 5,
'style' => 'padding: 15px;',
),
) );
//Padding
Expand All @@ -175,6 +180,7 @@ public function render_content() {
array(
'sanitize_callback' => 'absint',
'default' => '100',
'transport' => 'postMessage',
)
);
$wp_customize->add_control( 'branding_padding_1024', array(
Expand All @@ -187,7 +193,6 @@ public function render_content() {
'min' => 20,
'max' => 350,
'step' => 5,
'style' => 'padding: 15px;',
),
) );

Expand Down Expand Up @@ -219,7 +224,6 @@ public function render_content() {
'min' => 0,
'max' => 200,
'step' => 5,
'style' => 'padding: 15px;',
),
) );
//Hide meta
Expand Down Expand Up @@ -442,7 +446,6 @@ public function render_content() {
'min' => 10,
'max' => 90,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
// Site description
Expand All @@ -463,7 +466,6 @@ public function render_content() {
'min' => 10,
'max' => 50,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
//H1 size
Expand All @@ -484,7 +486,6 @@ public function render_content() {
'min' => 10,
'max' => 60,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
//H2 size
Expand All @@ -505,7 +506,6 @@ public function render_content() {
'min' => 10,
'max' => 60,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
//H3 size
Expand All @@ -526,7 +526,6 @@ public function render_content() {
'min' => 10,
'max' => 60,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
//H4 size
Expand All @@ -547,7 +546,6 @@ public function render_content() {
'min' => 10,
'max' => 60,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
//H5 size
Expand All @@ -568,7 +566,6 @@ public function render_content() {
'min' => 10,
'max' => 60,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
//H6 size
Expand All @@ -589,7 +586,6 @@ public function render_content() {
'min' => 10,
'max' => 60,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );
//Body
Expand All @@ -610,7 +606,6 @@ public function render_content() {
'min' => 10,
'max' => 24,
'step' => 1,
'style' => 'margin-bottom: 15px; padding: 10px;',
),
) );

Expand All @@ -621,6 +616,7 @@ public function render_content() {
array(
'default' => '#23B6B6',
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
Expand Down Expand Up @@ -783,6 +779,7 @@ public function render_content() {
array(
'default' => '#17191B',
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
Expand All @@ -796,12 +793,36 @@ public function render_content() {
)
)
);








//Extra options
$wp_customize->add_section( 'oblique_extra_options', array(
'title' => 'Extra options',
'priority' => 29
));

$wp_customize->add_setting( 'oblique_extra_options', array(
'sanitize_callback' => 'sanitize_text_field'
));

$wp_customize->add_control( new Oblique_Theme_Support( $wp_customize, 'oblique_extra_options', array(
'section' => 'oblique_extra_options',
)));


//Social icons
$wp_customize->add_setting(
'social_color',
array(
'default' => '#ffffff',
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
Expand Down Expand Up @@ -914,4 +935,4 @@ function oblique_asking_for_reviews_script() {
'ask' => $oblique_review,
'ajaxurl' => admin_url( 'admin-ajax.php' ),
) );
}
}
2 changes: 1 addition & 1 deletion inc/styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function oblique_custom_styles($custom) {
$custom .= ".svg-block { fill:#" . esc_attr($background_color) . ";}"."\n";
//Footer background
$footer_background = get_theme_mod( 'footer_background', '#17191B' );
$custom .= ".footer-svg.svg-block { fill:" . esc_attr($footer_background) . "!important;}"."\n";
$custom .= ".footer-svg.svg-block { fill:" . esc_attr($footer_background) . ";}"."\n";
$custom .= ".site-footer { background-color:" . esc_attr($footer_background) . ";}"."\n";
//Body
$body_text = get_theme_mod( 'body_text_color', '#50545C' );
Expand Down
80 changes: 79 additions & 1 deletion js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
$('.svg-block').css('fill', newval );
} );
});
// Primary color
wp.customize('primary_color',function( value ) {
value.bind( function( newval ) {
console.log(newval);
$('.read-more, button, .button, input[type="button"], input[type="reset"], input[type="submit"], .entry-thumb:after').css('background-color', newval);
});
});
// Font sizes
wp.customize('site_title_size',function( value ) {
value.bind( function( newval ) {
Expand Down Expand Up @@ -118,6 +125,77 @@
value.bind( function( newval ) {
$('.widget-area, .widget-area a').css('color', newval );
} );
});
});

// Footer background
wp.customize( 'footer_background', function( value ) {
value.bind( function( newval ) {
$( '.footer-svg' ).css( 'fill', newval );
$( '.site-footer' ).css( 'background-color', newval );
} );
});

// Social color
wp.customize( 'social_color', function( value ) {
value.bind( function( newval ) {
$( '#menu-social a' ).css( 'color', newval );
} );
});

// Search form - General
wp.customize('search_toggle',function( value ) {
value.bind( function() {
var item = $('.header-search');
if( item.hasClass('oblique-only-customizer') ) {
item.removeClass('oblique-only-customizer');
} else {
item.addClass('oblique-only-customizer');
}
} );
});

// Menu toggle - General
wp.customize( 'menu_text', function( value ) {
value.bind( function( newval ) {
var item = $( '.sidebar-toggle' );
if( '' !== newval ) {
item.find( '.fa-bars' ).addClass( 'oblique-only-customizer' );
item.find( 'span' ).removeClass( 'oblique-only-customizer' );
item.find( 'span' ).text( newval );
} else {
item.find( '.fa-bars' ).removeClass( 'oblique-only-customizer' );
item.find( 'span' ).addClass( 'oblique-only-customizer' );
item.find( 'span' ).text( newval );
}
} );
});

// Padding - Header
wp.customize( 'branding_padding', function( value ) {
value.bind( function( val ) {
console.log( val );
if( window.innerWidth > 1024 ) {
console.log( val );
$( '.site-branding' ).css( {
'padding-top': val + 'px',
'padding-bottom': val + 'px'
});
}
} );
});

// Padding < 1024 - Header
wp.customize( 'branding_padding_1024', function( value ) {
value.bind( function( val ) {
console.log( val );
if( window.innerWidth <= 1024 ) {
console.log( val );
$( '.site-branding' ).css({
'padding-top': val + 'px',
'padding-bottom': val + 'px'
});
}
} );
});

} )( jQuery );
Loading

0 comments on commit 579435a

Please sign in to comment.