Skip to content

Commit

Permalink
fix #1434
Browse files Browse the repository at this point in the history
  • Loading branch information
inc2734 committed Sep 14, 2024
1 parent a8ef65f commit 7dccade
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 19 deletions.
9 changes: 7 additions & 2 deletions app/widget/snow-monkey-recent-posts/_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.3.3
* @version 27.1.0
*/

use Framework\Helper;
Expand Down Expand Up @@ -84,9 +84,13 @@
: $instance['display-item-meta'] && ! in_array( $instance['layout'], array( 'text', 'text2' ), true );

$display_item_published = isset( $instance['display-item-published'] )
? $instance['display-item-published']
? $instance['display-item-meta'] && $instance['display-item-published']
: $instance['display-item-meta'];

$display_item_modified = isset( $instance['display-item-modified'] )
? $instance['display-item-meta'] && $instance['display-item-modified']
: false;

$display_item_excerpt = isset( $instance['display-item-excerpt'] )
? $instance['display-item-excerpt']
: in_array( $instance['layout'], array( 'rich-media', 'simple', 'caroucel' ), true );
Expand All @@ -108,6 +112,7 @@
'_display_item_meta' => $instance['display-item-meta'],
'_display_item_author' => $display_item_author,
'_display_item_published' => $display_item_published,
'_display_item_modified' => $display_item_modified,
'_display_item_terms' => $instance['display-item-terms'],
'_display_item_excerpt' => $display_item_excerpt,
'_link_text' => $instance['link-text'],
Expand Down
10 changes: 8 additions & 2 deletions app/widget/snow-monkey-recent-posts/snow-monkey-recent-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.4.6
* @version 27.1.0
*/

use Inc2734\WP_Awesome_Widgets\App\Contract\Widget as Abstract_Widget;
Expand All @@ -28,6 +28,7 @@ class Snow_Monkey_Recent_Posts_Widget extends Abstract_Widget {
'display-item-meta' => null,
'display-item-author' => null,
'display-item-published' => null,
'display-item-modified' => false,
'display-item-terms' => null,
'display-item-excerpt' => null,
'link-text' => null,
Expand Down Expand Up @@ -87,15 +88,20 @@ public function widget( $widget_args, $instance ) {
: $instance['display-item-meta'] && ! in_array( $instance['layout'], array( 'text', 'text2' ), true );

$display_item_published = isset( $instance['display-item-published'] )
? $instance['display-item-published']
? $instance['display-item-meta'] && $instance['display-item-published']
: $instance['display-item-meta'];

$display_item_modified = isset( $instance['display-item-modified'] )
? $instance['display-item-meta'] && $instance['display-item-modified']
: false;

$display_item_excerpt = isset( $instance['display-item-excerpt'] )
? $instance['display-item-excerpt']
: in_array( $instance['layout'], array( 'rich-media', 'simple', 'caroucel' ), true );

$instance['display-item-author'] = $display_item_author;
$instance['display-item-published'] = $display_item_published;
$instance['display-item-modified'] = $display_item_modified;
$instance['display-item-excerpt'] = $display_item_excerpt;

parent::widget( $widget_args, $instance );
Expand Down
9 changes: 7 additions & 2 deletions app/widget/snow-monkey-taxonomy-posts/_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.4.6
* @version 27.1.0
*/

use Framework\Helper;
Expand Down Expand Up @@ -148,9 +148,13 @@
: $instance['display-item-meta'] && ! in_array( $instance['layout'], array( 'text', 'text2' ), true );

$display_item_published = isset( $instance['display-item-published'] )
? $instance['display-item-published']
? $instance['display-item-meta'] && $instance['display-item-published']
: $instance['display-item-meta'];

$display_item_modified = isset( $instance['display-item-modified'] )
? $instance['display-item-meta'] && $instance['display-item-modified']
: false;

$display_item_excerpt = isset( $instance['display-item-excerpt'] )
? $instance['display-item-excerpt']
: in_array( $instance['layout'], array( 'rich-media', 'simple', 'caroucel' ), true );
Expand All @@ -172,6 +176,7 @@
'_display_item_meta' => $instance['display-item-meta'],
'_display_item_author' => $display_item_author,
'_display_item_published' => $display_item_published,
'_display_item_modified' => $display_item_modified,
'_display_item_terms' => $instance['display-item-terms'],
'_display_item_excerpt' => $display_item_excerpt,
'_category_label_taxonomy' => $instance['category-label-taxonomy'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.4.6
* @version 27.1.0
*/

use Inc2734\WP_Awesome_Widgets\App\Contract\Widget as Abstract_Widget;
Expand All @@ -28,6 +28,7 @@ class Snow_Monkey_Taxonomy_Posts_Widget extends Abstract_Widget {
'display-item-meta' => null,
'display-item-author' => null,
'display-item-published' => null,
'display-item-modified' => false,
'display-item-terms' => null,
'category-label-taxonomy' => null,
'use-own-category-label' => null,
Expand Down Expand Up @@ -90,15 +91,20 @@ public function widget( $widget_args, $instance ) {
: $instance['display-item-meta'] && ! in_array( $instance['layout'], array( 'text', 'text2' ), true );

$display_item_published = isset( $instance['display-item-published'] )
? $instance['display-item-published']
? $instance['display-item-meta'] && $instance['display-item-published']
: $instance['display-item-meta'];

$display_item_modified = isset( $instance['display-item-modified'] )
? $instance['display-item-meta'] && $instance['display-item-modified']
: false;

$display_item_excerpt = isset( $instance['display-item-excerpt'] )
? $instance['display-item-excerpt']
: in_array( $instance['layout'], array( 'rich-media', 'simple', 'caroucel' ), true );

$instance['display-item-author'] = $display_item_author;
$instance['display-item-published'] = $display_item_published;
$instance['display-item-modified'] = $display_item_modified;
$instance['display-item-excerpt'] = $display_item_excerpt;

parent::widget( $widget_args, $instance );
Expand Down
4 changes: 3 additions & 1 deletion template-parts/common/entries/entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.3.0
* @version 27.1.0
*
* renamed: template-parts/common/entries.php
*/
Expand Down Expand Up @@ -37,13 +37,15 @@
$archive_view = get_theme_mod( $_post_type . '-archive-view' );
$display_item_author = 'post' === $archive_view ? true : get_theme_mod( $_post_type . '-entries-display-item-author' );
$display_item_published = 'post' === $archive_view ? true : get_theme_mod( $_post_type . '-entries-display-item-published' );
$display_item_modified = get_theme_mod( $_post_type . '-entries-display-item-modified' );
$display_item_excerpt = 'post' === $archive_view ? true : get_theme_mod( $_post_type . '-entries-display-item-excerpt' );

$args = wp_parse_args(
$args,
array(
'_display_item_author' => $args['_display_item_meta'] && $display_item_author,
'_display_item_published' => $args['_display_item_meta'] && $display_item_published,
'_display_item_modified' => $args['_display_item_meta'] && $display_item_modified,
'_display_item_excerpt' => $display_item_excerpt,
)
);
Expand Down
4 changes: 3 additions & 1 deletion template-parts/common/entries/entries/carousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.3.2
* @version 27.1.0
*/

use Framework\Helper;
Expand Down Expand Up @@ -42,6 +42,7 @@
array(
'_display_item_author' => $args['_display_item_meta'],
'_display_item_published' => $args['_display_item_meta'],
'_display_item_modified' => false,
)
);

Expand Down Expand Up @@ -112,6 +113,7 @@
'_display_meta' => $args['_display_item_meta'],
'_display_author' => $args['_display_item_author'],
'_display_published' => $args['_display_item_published'],
'_display_modified' => $args['_display_item_modified'],
'_display_item_excerpt' => $args['_display_item_excerpt'],
'_terms' => $_terms ? array( $_terms[0] ) : array(),
'_title_tag' => $args['_item_title_tag'],
Expand Down
4 changes: 3 additions & 1 deletion template-parts/common/entries/entries/posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.2.0
* @version 27.1.0
*/

use Framework\Helper;
Expand Down Expand Up @@ -39,6 +39,7 @@
array(
'_display_item_author' => $args['_display_item_meta'],
'_display_item_published' => $args['_display_item_meta'],
'_display_item_modified' => false,
)
);

Expand Down Expand Up @@ -114,6 +115,7 @@ class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"
'_thumbnail_size' => $args['_item_thumbnail_size'],
'_display_author' => $args['_display_item_author'],
'_display_published' => $args['_display_item_published'],
'_display_modified' => $args['_display_item_modified'],
'_display_item_excerpt' => $args['_display_item_excerpt'],
'_terms' => $_terms ? array( $_terms[0] ) : array(),
'_title_tag' => $args['_item_title_tag'],
Expand Down
4 changes: 3 additions & 1 deletion template-parts/loop/entry-summary-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.1.1
* @version 27.1.0
*/

use Framework\Helper;
Expand Down Expand Up @@ -31,6 +31,7 @@
array(
'_display_author' => $args['_display_meta'],
'_display_published' => $args['_display_meta'],
'_display_modified' => false,
)
);
?>
Expand Down Expand Up @@ -93,6 +94,7 @@
'_entries_id' => $args['_entries_id'],
'_display_author' => $args['_display_author'],
'_display_published' => $args['_display_published'],
'_display_modified' => $args['_display_modified'],
'_terms' => $args['_terms'],
)
);
Expand Down
4 changes: 3 additions & 1 deletion template-parts/loop/entry-summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.1.1
* @version 27.1.0
*
* renamed: template-parts/entry-summary.php
*/
Expand Down Expand Up @@ -31,6 +31,7 @@
array(
'_display_author' => $args['_display_meta'],
'_display_published' => $args['_display_meta'],
'_display_modified' => false,
)
);
?>
Expand Down Expand Up @@ -93,6 +94,7 @@
'_entries_id' => $args['_entries_id'],
'_display_author' => $args['_display_author'],
'_display_published' => $args['_display_published'],
'_display_modified' => $args['_display_modified'],
'_terms' => $args['_terms'],
)
);
Expand Down
16 changes: 11 additions & 5 deletions template-parts/loop/entry-summary/meta/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 20.1.0
* @version 27.1.0
*/

use Framework\Helper;
Expand All @@ -16,9 +16,12 @@
'_entries_id' => null,
'_display_author' => false,
'_display_published' => false,
'_display_modified' => false,
'_terms' => array(),
)
);

$date_format = get_option( 'date_format' );
?>

<div class="c-entry-summary__meta">
Expand All @@ -34,10 +37,13 @@

<?php if ( $args['_display_published'] ) : ?>
<li class="c-meta__item c-meta__item--published">
<?php
$date_format = get_option( 'date_format' );
the_time( $date_format );
?>
<?php the_time( $date_format ); ?>
</li>
<?php endif; ?>

<?php if ( $args['_display_modified'] ) : ?>
<li class="c-meta__item c-meta__item--modified">
<?php the_modified_time( $date_format ); ?>
</li>
<?php endif; ?>

Expand Down
4 changes: 3 additions & 1 deletion template-parts/widget/snow-monkey-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package snow-monkey
* @author inc2734
* @license GPL-2.0+
* @version 25.3.0
* @version 27.1.0
*/

use Framework\Helper;
Expand Down Expand Up @@ -67,6 +67,7 @@
array(
'_display_item_author' => $args['_display_item_meta'],
'_display_item_published' => $args['_display_item_meta'],
'_display_item_modified' => false,
)
);

Expand Down Expand Up @@ -128,6 +129,7 @@
'_display_item_meta' => $args['_display_item_meta'],
'_display_item_author' => $args['_display_item_author'],
'_display_item_published' => $args['_display_item_published'],
'_display_item_modified' => $args['_display_item_modified'],
'_display_item_terms' => $args['_display_item_terms'],
'_display_item_excerpt' => $args['_display_item_excerpt'],
'_category_label_taxonomy' => $args['_category_label_taxonomy'],
Expand Down

0 comments on commit 7dccade

Please sign in to comment.