mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Merge pull request #1847 from woocommerce/PCP-1961-single-product-button-placement-on-block-themes
Improve single product page button placement with Block themes (1961)
This commit is contained in:
commit
6c28766f6c
1 changed files with 26 additions and 1 deletions
|
@ -273,7 +273,12 @@ class CompatModule implements ModuleInterface {
|
||||||
add_action(
|
add_action(
|
||||||
'init',
|
'init',
|
||||||
function() {
|
function() {
|
||||||
if ( $this->is_elementor_pro_active() || $this->is_divi_theme_active() ) {
|
if (
|
||||||
|
$this->is_block_theme_active()
|
||||||
|
|| $this->is_elementor_pro_active()
|
||||||
|
|| $this->is_divi_theme_active()
|
||||||
|
|| $this->is_divi_child_theme_active()
|
||||||
|
) {
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_paypal_payments_single_product_renderer_hook',
|
'woocommerce_paypal_payments_single_product_renderer_hook',
|
||||||
function(): string {
|
function(): string {
|
||||||
|
@ -286,6 +291,15 @@ class CompatModule implements ModuleInterface {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current theme is a blocks theme.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function is_block_theme_active(): bool {
|
||||||
|
return function_exists( 'wp_is_block_theme' ) && wp_is_block_theme();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the Elementor Pro plugins (allowing integrations with WC) is active.
|
* Checks whether the Elementor Pro plugins (allowing integrations with WC) is active.
|
||||||
*
|
*
|
||||||
|
@ -304,4 +318,15 @@ class CompatModule implements ModuleInterface {
|
||||||
$theme = wp_get_theme();
|
$theme = wp_get_theme();
|
||||||
return $theme->get( 'Name' ) === 'Divi';
|
return $theme->get( 'Name' ) === 'Divi';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether a Divi child theme is currently used.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function is_divi_child_theme_active(): bool {
|
||||||
|
$theme = wp_get_theme();
|
||||||
|
$parent = $theme->parent();
|
||||||
|
return ( $parent && $parent->get( 'Name' ) === 'Divi' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue