style checkout page
This commit is contained in:
@ -10,7 +10,8 @@ add_action('after_setup_theme', 'disable_default_patterns');
|
||||
/**
|
||||
* Enqueue custom CSS file in block editor only
|
||||
*/
|
||||
function somos_infinitos_block_editor_styles() {
|
||||
function somos_infinitos_block_editor_styles()
|
||||
{
|
||||
// Only load in block editor, not in classic editor
|
||||
if (!is_classic_editor_active()) {
|
||||
wp_enqueue_style(
|
||||
@ -26,12 +27,13 @@ add_action('enqueue_block_editor_assets', 'somos_infinitos_block_editor_styles')
|
||||
/**
|
||||
* Check if classic editor is active
|
||||
*/
|
||||
function is_classic_editor_active() {
|
||||
function is_classic_editor_active()
|
||||
{
|
||||
// Check if the classic editor plugin is active
|
||||
if (class_exists('Classic_Editor')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Check if we're on the classic editor screen
|
||||
if (function_exists('get_current_screen')) {
|
||||
$screen = get_current_screen();
|
||||
@ -39,14 +41,15 @@ function is_classic_editor_active() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue custom CSS file on the frontend
|
||||
*/
|
||||
function somos_infinitos_frontend_styles() {
|
||||
function somos_infinitos_frontend_styles()
|
||||
{
|
||||
// Don't load in admin
|
||||
if (!is_admin()) {
|
||||
wp_enqueue_style(
|
||||
@ -85,33 +88,34 @@ add_filter('upload_mimes', 'cc_mime_types');
|
||||
/* Remove default CSS variables that come with Wordpress
|
||||
https://github.com/WordPress/gutenberg/issues/56180#issuecomment-1819222376
|
||||
*/
|
||||
function custom_wp_theme_json_default( $theme_json ) {
|
||||
$new_data = array(
|
||||
'version' => 2,
|
||||
'settings' => array(
|
||||
'color' => array(
|
||||
'palette' => array(),
|
||||
'gradients' => array(),
|
||||
),
|
||||
'shadow' => array(
|
||||
'presets' => array(),
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSizes' => array(),
|
||||
),
|
||||
// 'dimensions' => array(
|
||||
// 'aspectRatios' => array(),
|
||||
// ),
|
||||
// 'spacing' => array(
|
||||
// 'spacingScale' => array(
|
||||
// 'steps' => 0,
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
);
|
||||
return $theme_json->update_with( $new_data );
|
||||
function custom_wp_theme_json_default($theme_json)
|
||||
{
|
||||
$new_data = array(
|
||||
'version' => 2,
|
||||
'settings' => array(
|
||||
'color' => array(
|
||||
'palette' => array(),
|
||||
'gradients' => array(),
|
||||
),
|
||||
'shadow' => array(
|
||||
'presets' => array(),
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSizes' => array(),
|
||||
),
|
||||
// 'dimensions' => array(
|
||||
// 'aspectRatios' => array(),
|
||||
// ),
|
||||
// 'spacing' => array(
|
||||
// 'spacingScale' => array(
|
||||
// 'steps' => 0,
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
);
|
||||
return $theme_json->update_with($new_data);
|
||||
}
|
||||
add_filter( 'wp_theme_json_data_default', 'custom_wp_theme_json_default' );
|
||||
add_filter('wp_theme_json_data_default', 'custom_wp_theme_json_default');
|
||||
|
||||
// remove default woocommerce fonts
|
||||
add_filter('wp_theme_json_data_theme', 'disable_inter_font', 100);
|
||||
@ -152,3 +156,32 @@ function disable_inter_font($theme_json)
|
||||
}
|
||||
return $theme_json;
|
||||
}
|
||||
|
||||
|
||||
// Shortcode checkout
|
||||
delete_transient('wc_stripe_appearance');
|
||||
|
||||
// Block checkout
|
||||
delete_transient('wc_stripe_blocks_appearance');
|
||||
|
||||
add_filter('wc_stripe_upe_params', function ($stripe_params) {
|
||||
|
||||
// Affects block checkout
|
||||
$stripe_params['blocksAppearance'] = (object) ['theme' => 'night'];
|
||||
|
||||
// Affects shortcode checkout
|
||||
$stripe_params['appearance'] = (object) ['theme' => 'flat'];
|
||||
|
||||
return $stripe_params;
|
||||
});
|
||||
|
||||
add_filter( 'wc_stripe_upe_params', function ( $stripe_params ) {
|
||||
$stripe_params['appearance'] = (object) [
|
||||
'rules' => (object) [
|
||||
'.Label' => (object) [
|
||||
'color' => 'black'
|
||||
]
|
||||
],
|
||||
];
|
||||
return $stripe_params;
|
||||
} );
|
||||
Reference in New Issue
Block a user