Skip to content
Merged
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
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
= 1.3.1 =
* Fixed link colours changing after the 1.3.0 update on sites that set a different colour for links and for buttons. Both were being written to the same internal colour slot, so whichever was saved last won and links took the button's colour
* Fixed child themes that swap out the theme's Bootstrap, FlexSlider or Owl Carousel. 1.3.0 renamed those asset handles, which silently turned `wp_dequeue_style( 'bootstrap' )` into a no-op -- the parent's stylesheet came back on top of the child's replacement, with no error to explain it. The old handle names work again, while the rename that stopped plugins suppressing the theme's own stylesheets stays in place

= 1.3.0 =
* Removed the vendored Epsilon customizer framework. It was 144 files and 1.3 MB -- 52% of the theme -- and provided 31 toggle controls, one slider, two customizer sections and the welcome screen. All of those are now built on core WordPress APIs. The download is roughly a third smaller and the theme ships 51 PHP files instead of 88
* Added theme.json, so the palette, type scale and layout widths have a single source of truth that the block editor reads. Colour options in the customizer still work exactly as before -- each one now overrides the matching theme.json value rather than maintaining a second palette
Expand Down
92 changes: 89 additions & 3 deletions inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,18 +355,25 @@ function shapely_enqueue_theme_options_css() {
* Only emitted when a mod is actually set, so an untouched site keeps
* the theme.json defaults verbatim.
*/
/*
* One theme mod per preset slug, never two.
*
* 1.3.0 mapped link_color and button_color both onto 'primary', so on a
* site that set different colours for links and buttons the second one
* silently overwrote the first: links rendered in the button's colour.
* Buttons have their own slugs now.
*/
$presets = array(
'link_color' => 'primary',
'link_hover_color' => 'primary-hover',
'button_color' => 'primary',
'button_hover_color' => 'primary-hover',
'button_color' => 'button',
'button_hover_color' => 'button-hover',
);

$vars = array();
foreach ( $presets as $mod => $slug ) {
$value = get_theme_mod( $mod );
if ( $value ) {
// Later keys win, which is why button_* follows link_*.
$vars[ $slug ] = $value;
}
}
Expand Down Expand Up @@ -1231,3 +1238,82 @@ function shapely_get_thumbnail( $size = 'full', $default_file = 'placeholder.jpg
);
}
endif;

if ( ! function_exists( 'shapely_legacy_asset_handles' ) ) :
/**
* The generic asset handles this theme used before 1.3.0.
*
* @return array old handle => current handle
*/
function shapely_legacy_asset_handles() {
return array(
'bootstrap' => 'shapely-bootstrap',
'flexslider' => 'shapely-flexslider',
'owl.carousel' => 'shapely-owl-carousel',
'owl.carousel.theme' => 'shapely-owl-carousel-theme',
);
}
endif;

if ( ! function_exists( 'shapely_register_legacy_handle_aliases' ) ) :
/**
* Keep pre-1.3.0 handle names working for child themes.
*
* 1.3.0 renamed four generic handles so a plugin claiming 'bootstrap' could
* no longer suppress the theme's own stylesheet. That fixed a real fault,
* but it silently broke the most common child-theme pattern there is:
*
* wp_dequeue_style( 'bootstrap' ); // swap in my own build
*
* After the rename that call names a handle nobody registers, so it does
* nothing, the parent's Bootstrap loads again, and it lands on top of
* whatever the child theme had replaced it with. Nothing errors -- the
* layout just changes under them on update.
*
* So each old name is registered as an empty placeholder and enqueued. If a
* child theme dequeues it, shapely_mirror_legacy_handle_dequeues() sees that
* and drops the real stylesheet too, which is what the old code did.
*
* The placeholder is only registered when nothing else has claimed the
* handle, so this does not put the theme back in the business of squatting
* on generic names.
*/
function shapely_register_legacy_handle_aliases() {
foreach ( shapely_legacy_asset_handles() as $legacy => $current ) {
if ( wp_style_is( $legacy, 'registered' ) ) {
// Someone else owns this handle; leave it alone.
continue;
}

// src of false registers the handle without ever requesting a file.
wp_register_style( $legacy, false, array(), SHAPELY_VERSION );
wp_enqueue_style( $legacy );
}
}
endif;

add_action( 'wp_enqueue_scripts', 'shapely_register_legacy_handle_aliases', 11 );

if ( ! function_exists( 'shapely_mirror_legacy_handle_dequeues' ) ) :
/**
* Apply a dequeue of an old handle to the stylesheet it used to name.
*
* Runs late so child themes and plugins -- which conventionally hook
* wp_enqueue_scripts at 10 or 20 -- have already had their say.
*/
function shapely_mirror_legacy_handle_dequeues() {
foreach ( shapely_legacy_asset_handles() as $legacy => $current ) {
if ( ! wp_style_is( $legacy, 'registered' ) ) {
// Deregistered outright, which the old code treated as removal.
wp_dequeue_style( $current );
continue;
}

if ( ! wp_style_is( $legacy, 'enqueued' ) ) {
wp_dequeue_style( $current );
}
}
}
endif;

add_action( 'wp_enqueue_scripts', 'shapely_mirror_legacy_handle_dequeues', 100 );
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shapely",
"version": "1.3.0",
"version": "1.3.1",
"description": "Build and lint tooling for the Shapely WordPress theme.",
"homepage": "https://www.colorlib.com",
"author": "Colorlib",
Expand Down
12 changes: 11 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ This page template is used to create the Parallax homepage from our demo : https

== Upgrade Notice ==

= 1.3.1 =
Fixes two regressions from 1.3.0: links taking the button colour when the two
were set differently, and child themes that replace the theme's Bootstrap,
FlexSlider or Owl Carousel silently getting the parent's copy back. Both are
fixed automatically -- nothing to change on your site.

= 1.3.0 =
Removes the bundled Epsilon framework and adds theme.json. Your settings carry
over untouched and the site should look identical. Child themes that dequeue the
Expand All @@ -76,6 +82,10 @@ shapely-owl-carousel-theme.

== Changelog ==

= 1.3.1 =
* Fixed link colours changing after the 1.3.0 update on sites that set a different colour for links and for buttons. Both were being written to the same internal colour slot, so whichever was saved last won and links took the button's colour
* Fixed child themes that swap out the theme's Bootstrap, FlexSlider or Owl Carousel. 1.3.0 renamed those asset handles, which silently turned `wp_dequeue_style( 'bootstrap' )` into a no-op -- the parent's stylesheet came back on top of the child's replacement, with no error to explain it. The old handle names work again, while the rename that stopped plugins suppressing the theme's own stylesheets stays in place

= 1.3.0 =
* Removed the vendored Epsilon customizer framework. It was 144 files and 1.3 MB -- 52% of the theme -- and provided 31 toggle controls, one slider, two customizer sections and the welcome screen. All of those are now built on core WordPress APIs. The download is roughly a third smaller and the theme ships 51 PHP files instead of 88
* Added theme.json, so the palette, type scale and layout widths have a single source of truth that the block editor reads. Colour options in the customizer still work exactly as before -- each one now overrides the matching theme.json value rather than maintaining a second palette
Expand Down Expand Up @@ -229,4 +239,4 @@ shapely-owl-carousel-theme.
= 1.0.0 - March 26 2016 =
* Initial release

Stable tag: 1.3.0
Stable tag: 1.3.1
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: https://colorlib.com/wp/themes/shapely/
Author: Colorlib
Author URI: https://colorlib.com
Description: Shapely is a one-page WordPress theme for business, portfolio and small e-commerce sites. The front page is assembled from widgets, so you can stack parallax sections, a portfolio grid, testimonials, a client logo carousel, a call to action and a contact block in whatever order you need. It also ships conventional blog templates with a choice of left, right, full-width or no sidebar, four footer widget areas, and a social icon menu. WooCommerce and Jetpack are supported, and the theme is translation ready.
Version: 1.3.0
Version: 1.3.1
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Expand Down
14 changes: 12 additions & 2 deletions theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
"color": "#5234f9",
"name": "Primary hover"
},
{
"slug": "button",
"color": "#745cf9",
"name": "Button"
},
{
"slug": "button-hover",
"color": "#5234f9",
"name": "Button hover"
},
{
"slug": "heading",
"color": "#0e1015",
Expand Down Expand Up @@ -140,7 +150,7 @@
},
"button": {
"color": {
"background": "var(--wp--preset--color--primary)",
"background": "var(--wp--preset--color--button)",
"text": "var(--wp--preset--color--background)"
},
"border": {
Expand All @@ -153,7 +163,7 @@
},
":hover": {
"color": {
"background": "var(--wp--preset--color--primary-hover)",
"background": "var(--wp--preset--color--button-hover)",
"text": "var(--wp--preset--color--background)"
}
}
Expand Down
Loading