File tree Expand file tree Collapse file tree 5 files changed +48
-20
lines changed Expand file tree Collapse file tree 5 files changed +48
-20
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
// 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
+ ?>
15
16
<article><?php if ( has_post_thumbnail () ) : ?>
16
17
<div class="posted-on"><?php the_time ( 'F d, Y ' ); ?> </div>
17
18
<div class="post-thumbnail"><a href="<?php the_permalink (); ?> " rel="bookmark"><?php the_post_thumbnail ( 'medium ' ); ?> </a></div>
Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
// 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
+ ?>
15
16
<article><?php if ( has_post_thumbnail () ) : ?>
16
17
<div class="post-thumbnail"><a href="<?php the_permalink (); ?> " rel="bookmark"><?php the_post_thumbnail ( 'medium ' ); ?> </a></div>
17
18
<?php endif ; ?>
Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
// The Loop.
12
- if ( $ posts ->have_posts () ) : ?>
12
+ if ( $ this -> query ->have_posts () ) : ?>
13
13
<div class="cards">
14
14
<?php
15
- while ( $ posts ->have_posts () ) :
16
- $ posts ->the_post ();
15
+ while ( $ this ->query ->have_posts () ) :
16
+ $ this ->query ->the_post ();
17
+
17
18
?>
18
19
<article>
19
20
<?php if ( has_post_thumbnail () ) : ?>
Original file line number Diff line number Diff line change 5
5
* This file produces a basic unordered list out of queried posts
6
6
* with the linked title, and the post date
7
7
*
8
- * @since 0.2.4
8
+ * @package custom-query-shortcode
9
+ * @since 0.2.4
10
+ * @version 0.5.0
9
11
*/
10
12
11
- if ( $ posts ->have_posts () ) {
13
+ // Prevent direct access.
14
+ if ( ! defined ( 'ABSPATH ' ) ) {
15
+ exit ;
16
+ }
17
+
18
+
19
+ if ( $ this ->query ->have_posts () ) {
12
20
?> <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> – <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> – <span class="posted-on"><?php the_time ( 'F d, Y ' ); ?> </span></li>
15
27
<?php endwhile ; ?>
16
- </ul><?php
28
+ </ul>
29
+ <?php
17
30
}
18
- wp_reset_postdata ();
31
+ wp_reset_postdata ();
Original file line number Diff line number Diff line change 4
4
*
5
5
* This file produces a basic unordered list out of queried posts
6
6
*
7
+ * @package custom-query-shortcode
7
8
* @since 0.2.4
9
+ * @version 0.5.0
8
10
*/
9
11
10
- if ( $ posts ->have_posts () ) {
12
+ // Prevent direct access.
13
+ if ( ! defined ( 'ABSPATH ' ) ) {
14
+ exit ;
15
+ }
16
+
17
+
18
+ if ( $ this ->query ->have_posts () ) :
11
19
?> <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
+ ?>
13
25
<li><a href="<?php the_permalink (); ?> " rel="bookmark"><?php the_title (); ?> </a></li>
14
26
<?php endwhile ; ?>
15
- </ul><?php
16
- }
17
- wp_reset_postdata () ;
27
+ </ul>
28
+ <?php
29
+ endif ;
You can’t perform that action at this time.
0 commit comments