Add customizer option to change story cover shadow

This commit is contained in:
Tetrakern 2024-08-09 20:04:04 +02:00
parent 29c3f4b7ee
commit a86cd91888
2 changed files with 35 additions and 0 deletions

View File

@ -1882,6 +1882,39 @@ function fictioneer_add_layout_customizer_settings( $manager ) {
)
);
// Story cover shadow
$manager->add_setting(
'story_cover_shadow',
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
'default' => apply_filters( 'fictioneer_filter_customizer_story_cover_shadow_default', 'var(--box-shadow-xl)' )
)
);
$cover_shadows = array(
'none' => _x( 'No Shadow', 'Customizer story cover shadow option.', 'fictioneer' ),
'var(--box-shadow-border)' => _x( 'Border Shadow', 'Customizer story cover shadow option.', 'fictioneer' ),
'var(--box-shadow-xs)' => _x( 'Shadow Thin', 'Customizer story cover shadow option.', 'fictioneer' ),
'var(--box-shadow-s)' => _x( 'Shadow Small', 'Customizer story cover shadow option.', 'fictioneer' ),
'var(--box-shadow)' => _x( 'Shadow Normal', 'Customizer story cover shadow option.', 'fictioneer' ),
'var(--box-shadow-m)' => _x( 'Shadow Medium', 'Customizer story cover shadow option.', 'fictioneer' ),
'var(--box-shadow-l)' => _x( 'Shadow Large', 'Customizer story cover shadow option.', 'fictioneer' ),
'var(--box-shadow-xl)' => _x( 'Shadow Huge (Default)', 'Customizer story cover shadow option.', 'fictioneer' )
);
$manager->add_control(
'story_cover_shadow',
array(
'type' => 'select',
'priority' => 38.5,
'section' => 'layout',
'label' => __( 'Story Page Cover Shadow', 'fictioneer' ),
'description' => __( 'Choose the shadow for your cover.', 'fictioneer' ),
'choices' => apply_filters( 'fictioneer_filter_customizer_story_cover_shadow', $cover_shadows )
)
);
// Story cover width offset
$manager->add_setting(
'story_cover_width_offset',

View File

@ -727,6 +727,7 @@ function fictioneer_build_customize_css( $context = null ) {
$header_min = (int) get_theme_mod( 'header_height_min', 190 );
$header_max = (int) get_theme_mod( 'header_height_max', 380 );
$story_cover_width_offset = (int) get_theme_mod( 'story_cover_width_offset', 0 );
$story_cover_box_shadow = get_theme_mod( 'story_cover_shadow', 'var(--box-shadow-xl)' );
$card_grid_column_min = (int) get_theme_mod( 'card_grid_column_min', 308 );
$card_cover_width_mod = get_theme_mod( 'card_cover_width_mod', 1 );
$card_grid_column_gap_mod = get_theme_mod( 'card_grid_column_gap_mod', 1 );
@ -785,6 +786,7 @@ function fictioneer_build_customize_css( $context = null ) {
--card-cover-width-mod: {$card_cover_width_mod};
--card-box-shadow: {$card_box_shadow};
--card-drop-shadow: " . str_replace( 'box-', 'drop-', $card_box_shadow ) . ";
--story-cover-box-shadow: {$story_cover_box_shadow};
--floating-cover-image-width: " . fictioneer_get_css_clamp( 56, 200 + $story_cover_width_offset, 320, 768 ) . ";
--in-content-cover-image-width: " . fictioneer_get_css_clamp( 100, 200 + $story_cover_width_offset, 375, 768 ) . ";
}";