Skip to content

Commit

Permalink
Merge pull request #2204 from Automattic/alpha
Browse files Browse the repository at this point in the history
Release Nov 13
  • Loading branch information
dkoo committed Nov 13, 2023
2 parents bad68a5 + e7eff6d commit d40324e
Show file tree
Hide file tree
Showing 15 changed files with 429 additions and 635 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [1.80.0-alpha.4](https://github.com/Automattic/newspack-theme/compare/v1.80.0-alpha.3...v1.80.0-alpha.4) (2023-11-10)


### Bug Fixes

* avoid fatals on TEC updates ([#2203](https://github.com/Automattic/newspack-theme/issues/2203)) ([83ed541](https://github.com/Automattic/newspack-theme/commit/83ed5411342f2180a636b93e06d69679acde1679))

## [1.79.2](https://github.com/Automattic/newspack-theme/compare/v1.79.1...v1.79.2) (2023-11-10)


Expand Down
2 changes: 1 addition & 1 deletion newspack-joseph/sass/theme-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Author: Automattic
Author URI: https://newspack.com
Description:
Requires at least: WordPress 4.9.6
Version: 1.79.2
Version: 1.80.0-alpha.4
License: GNU General Public License v2 or later
License URI: LICENSE
Template: newspack-theme
Expand Down
2 changes: 1 addition & 1 deletion newspack-katharine/sass/theme-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Author: Automattic
Author URI: https://newspack.com
Description:
Requires at least: WordPress 4.9.6
Version: 1.79.2
Version: 1.80.0-alpha.4
License: GNU General Public License v2 or later
License URI: LICENSE
Template: newspack-theme
Expand Down
2 changes: 1 addition & 1 deletion newspack-nelson/sass/theme-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Author: Automattic
Author URI: https://newspack.com
Description:
Requires at least: WordPress 4.9.6
Version: 1.79.2
Version: 1.80.0-alpha.4
License: GNU General Public License v2 or later
License URI: LICENSE
Template: newspack-theme
Expand Down
2 changes: 1 addition & 1 deletion newspack-sacha/sass/theme-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Author: Automattic
Author URI: https://newspack.com
Description:
Requires at least: WordPress 4.9.6
Version: 1.79.2
Version: 1.80.0-alpha.4
License: GNU General Public License v2 or later
License URI: LICENSE
Template: newspack-theme
Expand Down
2 changes: 1 addition & 1 deletion newspack-scott/sass/theme-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Author: Automattic
Author URI: https://newspack.com
Description:
Requires at least: WordPress 4.9.6
Version: 1.79.2
Version: 1.80.0-alpha.4
License: GNU General Public License v2 or later
License URI: LICENSE
Template: newspack-theme
Expand Down
5 changes: 5 additions & 0 deletions newspack-theme/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1336,3 +1336,8 @@ function newspack_dequeue_mediaelement() {
if ( class_exists( 'Newspack_Multibranded_Site\Customizations\Theme_Colors' ) ) {
require get_template_directory() . '/inc/newspack-multibranded-site-plugin.php';
}

/**
* Woo Templates cache handling
*/
require get_template_directory() . '/woocommerce/templates.php';
143 changes: 0 additions & 143 deletions newspack-theme/inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1258,149 +1258,6 @@ function newspack_customize_register( $wp_customize ) {
'section' => 'footer_options',
)
);

/**
* WooCommerce Order Details settings
*/
$wp_customize->add_section(
'woocommerce_cart_options',
array(
'title' => esc_html__( 'Order Details', 'newspack' ),
'panel' => 'woocommerce',
)
);

// Add order details visibility options.
$wp_customize->add_setting(
'collapse_order_details',
array(
'default' => 'hide',
'sanitize_callback' => 'newspack_sanitize_radio',
)
);
$wp_customize->add_control(
'collapse_order_details',
array(
'type' => 'radio',
'label' => esc_html__( 'Order Details Visibility', 'newspack' ),
'choices' => array(
'hide' => esc_html__( 'Hide', 'newspack' ),
'toggle' => esc_html__( 'Hide, with ability to toggle open', 'newspack' ),
'display' => esc_html__( 'Show', 'newspack' ),
),
'section' => 'woocommerce_cart_options',
)
);

/**
* WooCommerce Thank You page details
*/
$wp_customize->add_section(
'woocommerce_thank_you',
array(
'title' => esc_html__( 'Thank You Page', 'newspack' ),
'panel' => 'woocommerce',
)
);

// Thank you page title.
$wp_customize->add_setting(
'woocommerce_thank_you_title',
array(
'default' => esc_html__( 'Order received', 'newspack' ),
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'woocommerce_thank_you_title',
array(
'type' => 'text',
'label' => esc_html__( 'Thank You page title', 'newspack' ),
'section' => 'woocommerce_thank_you',
)
);

// Thank you message text.
$wp_customize->add_setting(
'woocommerce_thank_you_message',
array(
'default' => esc_html__( 'Thank you. Your order has been received.', 'newspack' ),
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'woocommerce_thank_you_message',
array(
'type' => 'textarea',
'label' => esc_html__( 'Thank You message', 'newspack' ),
'description' => esc_html__( 'Text message that displays at the top of the "Thank You" page.' ),
'section' => 'woocommerce_thank_you',
)
);

// Thank you - display customer details
$wp_customize->add_setting(
'thank_you_customer_details_display',
array(
'default' => false,
'sanitize_callback' => 'newspack_sanitize_checkbox',
)
);

$wp_customize->add_control(
'thank_you_customer_details_display',
array(
'type' => 'checkbox',
'label' => esc_html__( 'Display Customer Details', 'newspack' ),
'description' => esc_html__( 'Display the customer\'s billing address below their transaction details.', 'newspack' ),
'section' => 'woocommerce_thank_you',
)
);

/**
* WooCommerce Advanced Settings
*/
$wp_customize->add_section(
'woocommerce_advanced',
array(
'title' => esc_html__( 'Advanced Settings', 'newspack' ),
'panel' => 'woocommerce',
)
);

// Dequeue WooCommerce block CSS on the homepage.
$wp_customize->add_setting(
'woocommerce_block_home_dequeue',
array(
'default' => false,
'sanitize_callback' => 'newspack_sanitize_checkbox',
)
);
$wp_customize->add_control(
'woocommerce_block_home_dequeue',
array(
'type' => 'checkbox',
'label' => esc_html__( 'Dequeue WooCommerce Block CSS on the homepage.', 'newspack' ),
'section' => 'woocommerce_advanced',
)
);

// Dequeue WooCommerce CSS on the homepage.
$wp_customize->add_setting(
'woocommerce_styles_home_dequeue',
array(
'default' => false,
'sanitize_callback' => 'newspack_sanitize_checkbox',
)
);
$wp_customize->add_control(
'woocommerce_styles_home_dequeue',
array(
'type' => 'checkbox',
'label' => esc_html__( 'Dequeue WooCommerce CSS on the homepage.', 'newspack' ),
'section' => 'woocommerce_advanced',
)
);
}
add_action( 'customize_register', 'newspack_customize_register' );

Expand Down
64 changes: 0 additions & 64 deletions newspack-theme/inc/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ function newspack_woocommerce_setup() {
* @return void
*/
function newspack_woocommerce_scripts() {
// Load WooCommerce styles from theme.
if ( true === get_theme_mod( 'woocommerce_styles_home_dequeue', false ) && is_front_page() ) {
return;
}
if (
function_exists( 'is_woocommerce' ) && is_woocommerce()
|| function_exists( 'is_cart' ) && is_cart()
Expand All @@ -48,25 +44,11 @@ function_exists( 'is_woocommerce' ) && is_woocommerce()
}
add_action( 'wp_enqueue_scripts', 'newspack_woocommerce_scripts' );

/**
* Optionally dequeue WooCommerce's block styles.
*/
function newspack_disable_woocommerce_block_styles() {
if ( true === get_theme_mod( 'woocommerce_block_home_dequeue', false ) && is_front_page() ) {
wp_deregister_style( 'wc-blocks-style' );
}
}
add_action( 'enqueue_block_assets', 'newspack_disable_woocommerce_block_styles', 999 );

/**
* Remove WooCommerce general styles.
*/
function newspack_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] );
if ( true === get_theme_mod( 'woocommerce_styles_home_dequeue', false ) && is_front_page() ) {
unset( $enqueue_styles['woocommerce-layout'] );
unset( $enqueue_styles['woocommerce-smallscreen'] );
}
return $enqueue_styles;
}
add_filter( 'woocommerce_enqueue_styles', 'newspack_dequeue_styles' );
Expand Down Expand Up @@ -148,36 +130,6 @@ function newspack_woocommerce_wrapper_after() {
}
add_action( 'woocommerce_after_main_content', 'newspack_woocommerce_wrapper_after' );

/**
* Filters the page title for the Thank You page.
*/
function newspack_thankyou_page_title( $title, $id ) {
if ( function_exists( 'is_order_received_page' ) &&
is_order_received_page() && get_the_ID() === $id ) {
$title = get_theme_mod( 'woocommerce_thank_you_title', esc_html__( 'Order received', 'newspack' ) );
}
return wp_kses_post( $title );
}
add_filter( 'the_title', 'newspack_thankyou_page_title', 10, 2 );

/**
* Filters the 'message' for the Thank You page.
*/
function newspack_thankyou_order_message() {
$thank_you_msg = get_theme_mod( 'woocommerce_thank_you_message', esc_html__( 'Thank you. Your order has been received.', 'newspack' ) );
return esc_html( $thank_you_msg );
}
add_filter( 'woocommerce_thankyou_order_received_text', 'newspack_thankyou_order_message' );

/**
* Remove the subscription 'thank you' message.
*/
function newspack_subscription_thank_you() {
return '';
}
add_filter( 'woocommerce_subscriptions_thank_you_message', 'newspack_subscription_thank_you' );


/**
* Override the Woo function that prints the shop page content.
*/
Expand Down Expand Up @@ -220,22 +172,6 @@ function woocommerce_before_shop_loop_wrapper_close() {
}
add_action( 'woocommerce_before_shop_loop', 'woocommerce_before_shop_loop_wrapper_close', 40 );

/*
* Check if any products in the card need shipping.
*
* @return bool $needs_shipping Whether the cart requires shipping.
*/
function newspack_checkout_needs_shipping() {
// Check to see if there are only virtual items in the cart.
$needs_shipping = false;
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( $cart_item['data']->needs_shipping() ) {
$needs_shipping = true;
}
}
return $needs_shipping;
}

/**
* Improve appearance of WooCommerce checkout.
*
Expand Down
2 changes: 1 addition & 1 deletion newspack-theme/sass/theme-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Author: Automattic
Author URI: https://newspack.com
Description:
Requires at least: WordPress 4.9.6
Version: 1.79.2
Version: 1.80.0-alpha.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: newspack
Expand Down

0 comments on commit d40324e

Please sign in to comment.