Add story cover positions float-top-[left|-right]

This commit is contained in:
Tetrakern 2024-08-02 14:19:36 +02:00
parent 74707a26e2
commit b206073e02
6 changed files with 57 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1660,6 +1660,8 @@ function fictioneer_add_layout_customizer_settings( $manager ) {
$story_cover_positions = array(
'top-left-overflow' => _x( 'Top-Left Overflow (Default)', 'Customizer story cover position option.', 'fictioneer' ),
'float-top-left' => _x( 'Floating Top-Left', 'Customizer story cover position option.', 'fictioneer' ),
'float-top-right' => _x( 'Floating Top-Right', 'Customizer story cover position option.', 'fictioneer' ),
'float-left' => _x( 'Floating Left', 'Customizer story cover position option.', 'fictioneer' ),
'float-right' => _x( 'Floating Right', 'Customizer story cover position option.', 'fictioneer' ),
'hide' => _x( 'Hide', 'Customizer story cover position option.', 'fictioneer' )

View File

@ -29,10 +29,11 @@ if ( function_exists( 'elementor_theme_do_location' ) && elementor_theme_do_loca
$story = $args['story_data'];
$story_id = $args['story_id'];
$post = get_post( $story_id );
$cover_position = get_theme_mod( 'story_cover_position', 'top-left-overflow' );
$thumbnail_shown = has_post_thumbnail( $story_id ) &&
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true ) &&
get_theme_mod( 'story_cover_position', 'top-left-overflow' ) === 'top-left-overflow';
! in_array( $cover_position, ['float-left', 'float-right', 'none'] );
$tax_shown = ! get_option( 'fictioneer_hide_taxonomies_on_pages' ) &&
$story['has_taxonomies'] &&
@ -55,6 +56,16 @@ if ( ( $args['context'] ?? 0 ) !== 'shortcode' ) {
$header_classes[] = 'padding-right';
}
if ( $cover_position === 'float-top-left' ) {
$header_classes[] = '_float-top-left';
$header_classes[] = 'padding-top';
}
if ( $cover_position === 'float-top-right' ) {
$header_classes[] = '_float-top-right';
$header_classes[] = 'padding-top';
}
// Filter classes
$header_classes = apply_filters( 'fictioneer_filter_story_header_classes', $header_classes, $args );

View File

@ -74,7 +74,7 @@ get_header(
}
if (
! in_array( $cover_position, ['top-left-overflow', 'hide'] ) &&
in_array( $cover_position, ['float-left', 'float-right'] ) &&
has_post_thumbnail( $story_id ) &&
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true )
) {

View File

@ -129,13 +129,50 @@ body:not(.logged-in) .story__actions :first-child:nth-last-child(3) {
}
&._no-thumbnail {
margin-top: var(--page-inset-top);
margin-bottom: 1.75rem;
.story__taxonomies {
margin-bottom: 1.5rem;
}
}
&:is(._no-thumbnail, ._float-top-left, ._float-top-right) {
display: block;
margin-top: var(--page-inset-top);
margin-bottom: 1.75rem;
}
&:is(._float-top-left, ._float-top-right) {
.story__taxonomies {
margin-top: .5rem;
}
&:not(._no-thumbnail) .story__taxonomies-space {
height: 1.5rem;
}
.story__identity {
display: inline;
}
}
&:is(._float-top-left, ._float-top-right) .story__thumbnail {
--this-img-height: auto;
--this-img-width: #{get_clamp(56, 200, 320, 768)};
&-image {
max-width: var(--this-img-width);
max-height: 300px;
}
}
&._float-top-left .story__thumbnail {
float: left;
margin: 0 get_clamp(20, 32, 375, 768) get_clamp(10, 32, 375, 768) 0;
}
&._float-top-right .story__thumbnail {
float: right;
margin: 0 0 get_clamp(10, 32, 375, 768) get_clamp(20, 32, 375, 768);
}
}
&__thumbnail {