PluginProbe
Getwid – Gutenberg Blocks / 3.0.2
Getwid – Gutenberg Blocks v3.0.2
3.0.2 3.0.1 3.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 trunk 1.8.7 1.9.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9
← All changes | includes/templates/recent-posts/post.php +106 -106 2.0.63.0.2 View file →
@@ -1,106 +1,106 @@
1 -<?php
2 -/**
3 - * Post template in Recent Posts Block
4 - */
5 -$archive_year = get_the_time('Y');
6 -$archive_month = get_the_time('m');
7 -$archive_day = get_the_time('d');
8 -
9 -$imageSize = ( ( isset($attributes['imageSize']) && $attributes['imageSize'] ) ? $attributes['imageSize'] : 'post-thumbnail');
10 -
11 -$showTitle = isset( $attributes['showTitle'] ) && $attributes['showTitle'];
12 -$showFeaturedImage = isset( $attributes['showFeaturedImage'] ) && $attributes['showFeaturedImage'] && has_post_thumbnail();
13 -$showCategories = isset( $attributes['showCategories'] ) && $attributes['showCategories'] && has_category();
14 -$showCommentsCount = isset( $attributes['showCommentsCount'] ) && $attributes['showCommentsCount'] && comments_open();
15 -$showContent = isset( $attributes['showContent'] ) ? $attributes['showContent'] : false;
16 -$showDate = isset( $attributes['showDate'] ) && $attributes['showDate'];
17 -$contentLength = isset( $attributes['contentLength'] ) ? $attributes['contentLength'] : false;
18 -
19 -/**
20 - *
21 - * @TODO: Temporary fix wpautop
22 - *
23 - */
24 -remove_filter('the_content', 'wpautop');
25 -
26 -?>
27 -
28 -<article id="post-<?php the_ID(); ?>" class="<?php echo esc_attr($extra_attr['block_name'].'__post');?>">
29 - <div class="<?php echo esc_attr($extra_attr['block_name'].'__post-wrapper');?>">
30 - <?php if ( $showFeaturedImage ) { ?>
31 - <div class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-thumbnail">
32 - <a href="<?php echo esc_url(get_permalink()); ?>"><?php
33 - the_post_thumbnail( $imageSize, array('alt' => the_title_attribute( 'echo=0' )));
34 - ?></a>
35 - </div>
36 - <?php } ?>
37 - <?php
38 - if($showTitle || $showDate || $showContent || $showCategories || $showCommentsCount):
39 - ?>
40 - <div class="<?php echo esc_attr($extra_attr['block_name'])?>__content-wrapper">
41 - <?php
42 - if($showTitle || $showDate):
43 - ?>
44 - <header class="<?php echo esc_attr($extra_attr['block_name'])?>__entry-header">
45 - <?php if ( $showTitle ) { ?>
46 - <?php the_title( '<'.esc_attr($attributes['titleTag']).' class="'.esc_attr($extra_attr['block_name']).'__post-title"><a href="'.esc_url(get_permalink()).'">', '</a></'.esc_attr($attributes['titleTag']).'>' ); ?>
47 - <?php } ?>
48 - <?php
49 - if($showDate):
50 - ?>
51 - <div class="<?php echo esc_attr($extra_attr['block_name'])?>__entry-meta">
52 - <?php if ( $showDate ) { ?>
53 - <span class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-date">
54 - <time datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><a href="<?php
55 - echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day) ); ?>"><?php
56 - echo esc_html( get_the_date( '' ) );
57 - ?></a></time>
58 - </span>
59 - <?php } ?>
60 - </div>
61 - <?php
62 - endif;
63 - ?>
64 - </header>
65 - <?php
66 - endif;
67 - ?>
68 - <?php if ( $showContent ) {
69 - ?><div class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-content"><?php
70 -
71 - echo esc_html( wp_trim_words( get_the_excerpt(), $contentLength ) );
72 -
73 - ?></div>
74 - <?php } ?>
75 -
76 - <?php
77 - if ( $showCategories || $showCommentsCount ) :
78 - ?>
79 - <footer class="<?php echo esc_attr($extra_attr['block_name'])?>__entry-footer">
80 - <?php if ( $showCategories ) { ?>
81 - <p class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-categories">
82 - <?php echo get_the_category_list(', '); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
83 - </p>
84 - <?php } ?>
85 - <?php if ( $showCommentsCount ) { ?>
86 - <p class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-comments">
87 - <a href="<?php echo esc_url( get_comments_link() ); ?>"><?php
88 - if ( get_comments_number() ) {
89 - //translators: %d is a comments count
90 - echo esc_html( sprintf( _n( '%d Comment', '%d Comments', get_comments_number(), 'getwid' ), get_comments_number() ) );
91 - } else {
92 - echo esc_html__( 'No comments', 'getwid' );
93 - }
94 - ?></a>
95 - </p>
96 - <?php } ?>
97 - </footer>
98 - <?php
99 - endif;
100 - ?>
101 - </div>
102 - <?php
103 - endif;
104 - ?>
105 - </div>
106 -</article>
1 +<?php
2 +/**
3 + * Post template in Recent Posts Block
4 + */
5 +$archive_year = get_the_time('Y');
6 +$archive_month = get_the_time('m');
7 +$archive_day = get_the_time('d');
8 +
9 +$imageSize = ( ( isset($attributes['imageSize']) && $attributes['imageSize'] ) ? $attributes['imageSize'] : 'post-thumbnail');
10 +
11 +$showTitle = isset( $attributes['showTitle'] ) && $attributes['showTitle'];
12 +$showFeaturedImage = isset( $attributes['showFeaturedImage'] ) && $attributes['showFeaturedImage'] && has_post_thumbnail();
13 +$showCategories = isset( $attributes['showCategories'] ) && $attributes['showCategories'] && has_category();
14 +$showCommentsCount = isset( $attributes['showCommentsCount'] ) && $attributes['showCommentsCount'] && comments_open();
15 +$showContent = isset( $attributes['showContent'] ) ? $attributes['showContent'] : false;
16 +$showDate = isset( $attributes['showDate'] ) && $attributes['showDate'];
17 +$contentLength = isset( $attributes['contentLength'] ) ? $attributes['contentLength'] : false;
18 +
19 +/**
20 + *
21 + * @TODO: Temporary fix wpautop
22 + *
23 + */
24 +remove_filter('the_content', 'wpautop');
25 +
26 +?>
27 +
28 +<article id="post-<?php the_ID(); ?>" class="<?php echo esc_attr($extra_attr['block_name'].'__post');?>">
29 + <div class="<?php echo esc_attr($extra_attr['block_name'].'__post-wrapper');?>">
30 + <?php if ( $showFeaturedImage ) { ?>
31 + <div class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-thumbnail">
32 + <a href="<?php echo esc_url(get_permalink()); ?>"><?php
33 + the_post_thumbnail( $imageSize, array('alt' => the_title_attribute( 'echo=0' )));
34 + ?></a>
35 + </div>
36 + <?php } ?>
37 + <?php
38 + if($showTitle || $showDate || $showContent || $showCategories || $showCommentsCount):
39 + ?>
40 + <div class="<?php echo esc_attr($extra_attr['block_name'])?>__content-wrapper">
41 + <?php
42 + if($showTitle || $showDate):
43 + ?>
44 + <header class="<?php echo esc_attr($extra_attr['block_name'])?>__entry-header">
45 + <?php if ( $showTitle ) { ?>
46 + <?php the_title( '<'.esc_attr($attributes['titleTag']).' class="'.esc_attr($extra_attr['block_name']).'__post-title"><a href="'.esc_url(get_permalink()).'">', '</a></'.esc_attr($attributes['titleTag']).'>' ); ?>
47 + <?php } ?>
48 + <?php
49 + if($showDate):
50 + ?>
51 + <div class="<?php echo esc_attr($extra_attr['block_name'])?>__entry-meta">
52 + <?php if ( $showDate ) { ?>
53 + <span class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-date">
54 + <time datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><a href="<?php
55 + echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day) ); ?>"><?php
56 + echo esc_html( get_the_date( '' ) );
57 + ?></a></time>
58 + </span>
59 + <?php } ?>
60 + </div>
61 + <?php
62 + endif;
63 + ?>
64 + </header>
65 + <?php
66 + endif;
67 + ?>
68 + <?php if ( $showContent ) {
69 + ?><div class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-content"><?php
70 +
71 + echo esc_html( wp_trim_words( get_the_excerpt(), $contentLength ) );
72 +
73 + ?></div>
74 + <?php } ?>
75 +
76 + <?php
77 + if ( $showCategories || $showCommentsCount ) :
78 + ?>
79 + <footer class="<?php echo esc_attr($extra_attr['block_name'])?>__entry-footer">
80 + <?php if ( $showCategories ) { ?>
81 + <p class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-categories">
82 + <?php echo get_the_category_list(', '); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
83 + </p>
84 + <?php } ?>
85 + <?php if ( $showCommentsCount ) { ?>
86 + <p class="<?php echo esc_attr($extra_attr['block_name']); ?>__post-comments">
87 + <a href="<?php echo esc_url( get_comments_link() ); ?>"><?php
88 + if ( get_comments_number() ) {
89 + //translators: %d is a comments count
90 + echo esc_html( sprintf( _n( '%d Comment', '%d Comments', get_comments_number(), 'getwid' ), get_comments_number() ) );
91 + } else {
92 + echo esc_html__( 'No comments', 'getwid' );
93 + }
94 + ?></a>
95 + </p>
96 + <?php } ?>
97 + </footer>
98 + <?php
99 + endif;
100 + ?>
101 + </div>
102 + <?php
103 + endif;
104 + ?>
105 + </div>
106 +</article>