Skip to content

Commit 51387c2

Browse files
committed
phpcs on all lenses fiels
1 parent c5ca354 commit 51387c2

File tree

5 files changed

+48
-20
lines changed

5 files changed

+48
-20
lines changed

lenses/article-excerpt-date.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
*/
1010

1111
// The Loop.
12-
if ( $posts->have_posts() ) :
13-
while ( $posts->have_posts() ) :
14-
$posts->the_post(); ?>
12+
if ( $this->query->have_posts() ) :
13+
while ( $this->query->have_posts() ) :
14+
$this->query->the_post();
15+
?>
1516
<article><?php if ( has_post_thumbnail() ) : ?>
1617
<div class="posted-on"><?php the_time( 'F d, Y' ); ?></div>
1718
<div class="post-thumbnail"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail( 'medium' ); ?></a></div>

lenses/article-excerpt.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
*/
1010

1111
// The Loop.
12-
if ( $posts->have_posts() ) :
13-
while ( $posts->have_posts() ) :
14-
$posts->the_post(); ?>
12+
if ( $this->query->have_posts() ) :
13+
while ( $this->query->have_posts() ) :
14+
$this->query->the_post();
15+
?>
1516
<article><?php if ( has_post_thumbnail() ) : ?>
1617
<div class="post-thumbnail"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail( 'medium' ); ?></a></div>
1718
<?php endif; ?>

lenses/cards.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
*/
1010

1111
// The Loop.
12-
if ( $posts->have_posts() ) : ?>
12+
if ( $this->query->have_posts() ) : ?>
1313
<div class="cards">
1414
<?php
15-
while ( $posts->have_posts() ) :
16-
$posts->the_post();
15+
while ( $this->query->have_posts() ) :
16+
$this->query->the_post();
17+
1718
?>
1819
<article>
1920
<?php if ( has_post_thumbnail() ) : ?>

lenses/ul-title-date.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,27 @@
55
* This file produces a basic unordered list out of queried posts
66
* with the linked title, and the post date
77
*
8-
* @since 0.2.4
8+
* @package custom-query-shortcode
9+
* @since 0.2.4
10+
* @version 0.5.0
911
*/
1012

11-
if( $posts->have_posts() ) {
13+
// Prevent direct access.
14+
if ( ! defined( 'ABSPATH' ) ) {
15+
exit;
16+
}
17+
18+
19+
if ( $this->query->have_posts() ) {
1220
?><ul class="custom-query">
13-
<?php while( $posts->have_posts() ) : $posts->the_post(); ?>
14-
<li><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> &ndash; <span class="posted-on"><?php the_time('F d, Y'); ?></span></li>
21+
<?php
22+
while ( $this->query->have_posts() ) :
23+
$this->query->the_post();
24+
25+
?>
26+
<li><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> &ndash; <span class="posted-on"><?php the_time( 'F d, Y' ); ?></span></li>
1527
<?php endwhile; ?>
16-
</ul><?php
28+
</ul>
29+
<?php
1730
}
18-
wp_reset_postdata();
31+
wp_reset_postdata();

lenses/ul.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,26 @@
44
*
55
* This file produces a basic unordered list out of queried posts
66
*
7+
* @package custom-query-shortcode
78
* @since 0.2.4
9+
* @version 0.5.0
810
*/
911

10-
if( $posts->have_posts() ) {
12+
// Prevent direct access.
13+
if ( ! defined( 'ABSPATH' ) ) {
14+
exit;
15+
}
16+
17+
18+
if ( $this->query->have_posts() ) :
1119
?><ul class="custom-query">
12-
<?php while( $posts->have_posts() ) : $posts->the_post(); ?>
20+
<?php
21+
while ( $this->query->have_posts() ) :
22+
$this->query->the_post();
23+
24+
?>
1325
<li><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></li>
1426
<?php endwhile; ?>
15-
</ul><?php
16-
}
17-
wp_reset_postdata();
27+
</ul>
28+
<?php
29+
endif;

0 commit comments

Comments
 (0)