Skip to content

Commit

Permalink
Merge branch 'release/1.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Jan 6, 2019
2 parents d8a828c + 12694d3 commit 0785a80
Show file tree
Hide file tree
Showing 46 changed files with 1,118 additions and 973 deletions.
6 changes: 3 additions & 3 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<link rel="profile" href="http://gmpg.org/xfn/11">
<meta charset="<?php bloginfo( 'charset' ); ?>">
<link rel="profile" href="https://gmpg.org/xfn/11">

<?php wp_head(); ?>
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
Expand Down
16 changes: 8 additions & 8 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function polestar_author_box() { ?>
<?php esc_html_e( 'View posts by ', 'polestar' );
echo get_the_author(); ?>
</a>
</span>
</span>
<?php if ( get_the_author_meta( 'description' ) ) : ?>
<div><?php echo wp_kses_post( get_the_author_meta( 'description' ) ); ?></div>
<?php endif; ?>
Expand Down Expand Up @@ -81,7 +81,7 @@ function polestar_mini_cart() {
* The callback function for wp_list_comments in comments.php.
*
* @link https://codex.wordpress.org/Function_Reference/wp_list_comments.
*/
*/
function polestar_comment( $comment, $args, $depth ) {
?>
<li <?php comment_class() ?> id="comment-<?php comment_ID() ?>">
Expand Down Expand Up @@ -125,7 +125,7 @@ function polestar_entry_footer() {

if ( is_single() && has_tag() && get_theme_mod( 'post_tags', true ) ) {
echo '<footer class="entry-footer"><span class="tags-links">' . get_the_tag_list() . '</span></footer>';
}
}
}
endif;

Expand Down Expand Up @@ -189,7 +189,7 @@ function polestar_display_featured_posts() {
* Display theme icons.
*/
function polestar_display_icon( $type ) {
switch( $type ) {
switch ( $type ) {
case 'add': ?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24">
<path d="M18.984 12.984h-6v6h-1.969v-6h-6v-1.969h6v-6h1.969v6h6v1.969z"></path>
Expand Down Expand Up @@ -368,7 +368,7 @@ function polestar_display_logo() {
$logo = get_theme_mod( 'logo' );

if ( $logo ) {
$attrs = apply_filters( 'polestar_logo_attributes', array() );
$attrs = apply_filters( 'polestar_logo_attributes', array( 'class' => 'custom-logo' ) );

?><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<span class="screen-reader-text"><?php esc_html_e( 'Home', 'polestar' ); ?></span><?php
Expand All @@ -387,12 +387,12 @@ function polestar_display_logo() {
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php if ( get_theme_mod( 'tagline' ) && get_bloginfo( 'description' ) ) : ?>
<p class="site-description"><?php bloginfo( 'description' ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php else : ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php if ( get_theme_mod( 'tagline' ) && get_bloginfo( 'description' ) ) : ?>
<p class="site-description"><?php bloginfo( 'description' ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php endif;
}
}
Expand Down Expand Up @@ -459,7 +459,7 @@ function polestar_post_meta() {
if ( get_theme_mod( 'post_author', true ) ) {
echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" rel="author">' . esc_html( get_the_author() ) . '</a></span></span>';
}

if ( comments_open() && get_theme_mod( 'post_comment_count', true ) ) {
echo '<span class="comments-link">';
comments_popup_link( esc_html__( 'Leave a comment', 'polestar' ), esc_html__( 'One Comment', 'polestar' ), esc_html__( '% Comments', 'polestar' ) );
Expand Down
182 changes: 95 additions & 87 deletions js/jquery.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jQuery( function( $ ) {
}

};

smSetup();
$( window ).resize( smSetup ).scroll( smSetup );

Expand All @@ -122,65 +123,8 @@ jQuery( function( $ ) {
smShadow();
$( window ).scroll( smShadow );

// Header padding to be used if logo scaling is enabled.
var mhPadding = {
top: parseInt( $mh.css( 'padding-top' ) ),
bottom: parseInt( $mh.css( 'padding-bottom' ) )
};

// Sticky header logo scaling.
if ( $mh.data( 'scale-logo' ) ) {
var $img = $mh.find( '.site-branding img' ),
imgWidth = $img.width(),
imgHeight = $img.height();
scaledWidth = imgWidth * polestar.logoScale;
scaledHeight = imgHeight * polestar.logoScale;

var smResizeLogo = function() {
var $branding = $mh.find( '.site-branding > *' ),
top = window.pageYOffset || document.documentElement.scrollTop;

// Check if the menu is meant to be sticky or not, and if it is apply padding/class.
if ( top > 0 ) {
$mh.css( {
'padding-top': mhPadding.top * polestar.logoScale,
'padding-bottom': mhPadding.bottom * polestar.logoScale
} ).addClass( 'stuck' );

} else {
$mh.css( {
'padding-top': mhPadding.top,
'padding-bottom': mhPadding.bottom
} ).removeClass( 'stuck' );
}

if ( $img.length ) {
// If Scale == polestar.logoScale, logo is completely scaled.
if ( $img.height() != scaledHeight || $img.width() != scaledWidth ) {
var scale = polestar.logoScale + ( Math.max( 0, 48 - top ) / 48 * ( 1 - polestar.logoScale ) );
$('.site-branding img').css( {
width: imgWidth * scale,
height: imgHeight * scale,
'max-width' : 'none'
} );
}
} else {
if ( top > 0 ) {
$branding.css( 'transform', 'scale(' + polestar.logoScale + ')' );
} else {
$branding.css( 'transform', 'scale(1)' );
}
}
};
smResizeLogo();
$( window ).scroll( smResizeLogo ).resize( smResizeLogo );
}
}

jQuery( window ).load( function() {
polestar.logoScale = parseFloat( polestar.logoScale );
} );

// Header search.
var $hs = $( '#header-search' );
$( '#masthead .search-icon' ).click( function() {
Expand Down Expand Up @@ -212,36 +156,37 @@ jQuery( function( $ ) {
} );

// Main menu.
// Remove the no-js body class.
$( 'body.no-js' ).removeClass( 'no-js' );
if ( $( 'body' ).hasClass( 'css3-animations' ) ) {

var polestarResetMenu = function() {
$( '.main-navigation ul ul' ).each( function() {
var $$ = $( this );
var width = Math.max.apply( Math, $$.find( '> li:not(.mini_cart_item) > a' ).map( function() {
return $( this ).width();
} ).get() );
$$.find( '> li > a' ).width( width );
} );
};
polestarResetMenu();
$( window ).resize( polestarResetMenu );
$( window ).load( function() {
$( 'body.no-js' ).removeClass( 'no-js' );
if ( $( 'body' ).hasClass( 'css3-animations' ) ) {

var polestarResetMenu = function() {
$( '.main-navigation ul ul' ).each( function() {
var $$ = $( this );
var width = Math.max.apply( Math, $$.find( '> li:not(.mini_cart_item) > a' ).map( function() {
return $( this ).width();
} ).get() );
$$.find( '> li > a' ).width( width );
} );
};
polestarResetMenu();
$( window ).resize( polestarResetMenu );

// Add keyboard access to the menu.
$( '.menu-item' ).children( 'a' ).focus( function() {
$( this ).parents( 'ul, li' ).addClass( 'focus' );
} );
// Add keyboard access to the menu.
$( '.menu-item' ).children( 'a' ).focus( function() {
$( this ).parents( 'ul, li' ).addClass( 'focus' );
} );

// Click event fires after focus event.
$( '.menu-item' ).children( 'a' ).click( function() {
$( this ).parents( 'ul, li' ).removeClass( 'focus' );
} );

$( '.menu-item' ).children( 'a' ).focusout( function() {
$( this ).parents( 'ul, li' ).removeClass( 'focus' );
} );
}
// Click event fires after focus event.
$( '.menu-item' ).children( 'a' ).click( function() {
$( this ).parents( 'ul, li' ).removeClass( 'focus' );
} );

$( '.menu-item' ).children( 'a' ).focusout( function() {
$( this ).parents( 'ul, li' ).removeClass( 'focus' );
} );
}
} );

// Main menu current menu item indication.
jQuery( document ).ready( function( $ ) {
Expand Down Expand Up @@ -277,7 +222,7 @@ jQuery( function( $ ) {
if ( $( 'body' ).hasClass( 'disable-smooth-scroll' ) ) {
return;
}

$( this ).click( function( e ) {

var hash = this.hash;
Expand Down Expand Up @@ -376,7 +321,7 @@ jQuery( function( $ ) {
$mobileMenu = $( '<div></div>' )
.append( $( '.main-navigation ul' ).first().clone() )
.attr( 'id', 'mobile-navigation' )
.appendTo( '#masthead' ).hide();
.appendTo( '#masthead' ).hide();

if ( $( '#header-search form' ).length ) {
$mobileMenu.append( $( '#header-search form' ).clone() );
Expand Down Expand Up @@ -432,3 +377,66 @@ jQuery( function( $ ) {
} );

} );

( function( $ ) {
$( window ).load( function() {

polestar.logoScale = parseFloat( polestar.logoScale );

// Header padding to be used if logo scaling is enabled.
var $mh = $( '#masthead' ),
mhPadding = {
top: parseInt( $mh.css( 'padding-top' ) ),
bottom: parseInt( $mh.css( 'padding-bottom' ) )
};

// Sticky header logo scaling.
if ( $mh.data( 'scale-logo' ) ) {
var $img = $mh.find( '.site-branding img' ),
imgWidth = $img.attr( 'width' ),
imgHeight = $img.attr( 'height' ),
scaledWidth = imgWidth * polestar.logoScale;
scaledHeight = imgHeight * polestar.logoScale;

var smResizeLogo = function() {
var $branding = $mh.find( '.site-branding > *' ),
top = window.pageYOffset || document.documentElement.scrollTop;

// Check if the menu is meant to be sticky or not, and if it is apply padding/class.
if ( top > 0 ) {
$mh.css( {
'padding-top': mhPadding.top * polestar.logoScale,
'padding-bottom': mhPadding.bottom * polestar.logoScale
} ).addClass( 'stuck' );

} else {
$mh.css( {
'padding-top': mhPadding.top,
'padding-bottom': mhPadding.bottom
} ).removeClass( 'stuck' );
}

if ( $img.length ) {
// If Scale == polestar.logoScale, logo is completely scaled.
if ( $img.height() != scaledHeight || $img.width() != scaledWidth ) {
var scale = polestar.logoScale + ( Math.max( 0, 48 - top ) / 48 * ( 1 - polestar.logoScale ) );
$('.site-branding img').css( {
width: imgWidth * scale,
height: imgHeight * scale,
'max-width' : 'none'
} );
}
} else {
if ( top > 0 ) {
$branding.css( 'transform', 'scale(' + polestar.logoScale + ')' );
} else {
$branding.css( 'transform', 'scale(1)' );
}
}
};
smResizeLogo();
$( window ).scroll( smResizeLogo ).resize( smResizeLogo );
}

} );
} )( jQuery );
10 changes: 9 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Contributors: Puro
Tags: one-column, two-columns, left-sidebar, right-sidebar, custom-background, custom-colors, custom-menu, custom-logo, featured-images, footer-widgets, full-width-template, post-formats, sticky-post, theme-options, threaded-comments, translation-ready, blog, e-commerce

Requires at least: 4.7+
Tested up to: 4.9.9
Tested up to: 5.0.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -151,6 +151,14 @@ Released under [GPL version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0

== Changelog ==

= 1.3.2 - 06 January 2019 =
* Fixed missing WooCommerce cart cross-sells.
* Minor WooCommerce cart styling improvements.
* Minor WooCommerce checkout styling improvements.
* Improved logo scaling function.
* Slightly darkened default background and border colors for improved usability.
* Changed the page order of the title and featured images to match posts.

= 1.3.1 - 05 November 2018 =
* Prevented Jetpack Lazy Images from loading the logo image.
* Improved sticky header logo scaling.
Expand Down
2 changes: 1 addition & 1 deletion sass/elements/_elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ hr {

@import "lists";

img {
img:not(.custom-logo) {
height: auto; // Make sure images are scaled correctly.
max-width: 100%; // Adhere to container width.
}
Expand Down
10 changes: 5 additions & 5 deletions sass/elements/_lists.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ul,
ul,
ol {
margin: 0 0 26px 25px;
padding: 0;
Expand All @@ -15,18 +15,18 @@ ol {
li > ul,
li > ol {
margin-top: 0;
margin-bottom: 0;
margin-bottom: 0;
}

dl {
margin: 0 0 26px;

dt {
font-weight: bold;
font-weight: bold;
font-weight: 600;
}

dd {
margin: 0 0 0 25px;
}
}
}
Loading

0 comments on commit 0785a80

Please sign in to comment.