Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions themes/twentynineteen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,30 @@ function twentynineteen_widgets_init() {
}
add_action( 'widgets_init', 'twentynineteen_widgets_init' );

/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... and
* a 'Continue reading' link.
*
* @since Twenty Nineteen 2.0
*
* @param string $link Link to single post/page.
* @return string 'Continue reading' link prepended with an ellipsis.
*/
function twentynineteen_excerpt_more( $link ) {
if ( is_admin() ) {
return $link;
}

$link = sprintf(
'<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Post title. */
sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentynineteen' ), get_the_title( get_the_ID() ) )
);
return ' &hellip; ' . $link;
}
add_filter( 'excerpt_more', 'twentynineteen_excerpt_more' );

/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
Expand Down
60 changes: 30 additions & 30 deletions themes/twentynineteen/js/customize-controls.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
/**
* File customize-controls.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
(function() {
wp.customize.bind( 'ready', function() {
// Only show the color hue control when there's a custom primary color.
wp.customize( 'primary_color', function( setting ) {
wp.customize.control( 'primary_color_hue', function( control ) {
var visibility = function() {
if ( 'custom' === setting.get() ) {
control.container.slideDown( 180 );
} else {
control.container.slideUp( 180 );
}
};
visibility();
setting.bind( visibility );
});
});
});
})();
/**
* File customize-controls.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/

(function() {

wp.customize.bind( 'ready', function() {

// Only show the color hue control when there's a custom primary color.
wp.customize( 'primary_color', function( setting ) {
wp.customize.control( 'primary_color_hue', function( control ) {
var visibility = function() {
if ( 'custom' === setting.get() ) {
control.container.slideDown( 180 );
} else {
control.container.slideUp( 180 );
}
};

visibility();
setting.bind( visibility );
});
});
});

})();
120 changes: 60 additions & 60 deletions themes/twentynineteen/js/customize-preview.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
/**
* File customize-preview.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
(function( $ ) {
// Primary color.
wp.customize( 'primary_color', function( value ) {
value.bind( function( to ) {
// Update custom color CSS.
var style = $( '#custom-theme-colors' ),
hue = style.data( 'hue' ),
css = style.html(),
color;
if( 'custom' === to ){
// If a custom primary color is selected, use the currently set primary_color_hue.
color = wp.customize.get().primary_color_hue;
} else {
// If the "default" option is selected, get the default primary_color_hue.
color = 199;
}
// Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed.
css = css.split( hue + ',' ).join( color + ',' );
style.html( css ).data( 'hue', color );
});
});
// Primary color hue.
wp.customize( 'primary_color_hue', function( value ) {
value.bind( function( to ) {
// Update custom color CSS.
var style = $( '#custom-theme-colors' ),
hue = style.data( 'hue' ),
css = style.html();
// Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed.
css = css.split( hue + ',' ).join( to + ',' );
style.html( css ).data( 'hue', to );
});
});
// Image filter.
wp.customize( 'image_filter', function( value ) {
value.bind( function( to ) {
if ( to ) {
$( 'body' ).addClass( 'image-filters-enabled' );
} else {
$( 'body' ).removeClass( 'image-filters-enabled' );
}
} );
} );
})( jQuery );
/**
* File customize-preview.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/

(function( $ ) {

// Primary color.
wp.customize( 'primary_color', function( value ) {
value.bind( function( to ) {
// Update custom color CSS.
var style = $( '#custom-theme-colors' ),
hue = style.data( 'hue' ),
css = style.html(),
color;

if( 'custom' === to ){
// If a custom primary color is selected, use the currently set primary_color_hue.
color = wp.customize.get().primary_color_hue;
} else {
// If the "default" option is selected, get the default primary_color_hue.
color = 199;
}

// Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed.
css = css.split( hue + ',' ).join( color + ',' );
style.html( css ).data( 'hue', color );
});
});

// Primary color hue.
wp.customize( 'primary_color_hue', function( value ) {
value.bind( function( to ) {

// Update custom color CSS.
var style = $( '#custom-theme-colors' ),
hue = style.data( 'hue' ),
css = style.html();

// Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed.
css = css.split( hue + ',' ).join( to + ',' );
style.html( css ).data( 'hue', to );
});
});

// Image filter.
wp.customize( 'image_filter', function( value ) {
value.bind( function( to ) {
if ( to ) {
$( 'body' ).addClass( 'image-filters-enabled' );
} else {
$( 'body' ).removeClass( 'image-filters-enabled' );
}
} );
} );

})( jQuery );
Loading