Skip to content

Commit

Permalink
Create loopy.php
Browse files Browse the repository at this point in the history
  • Loading branch information
d4s6 authored Feb 16, 2020
1 parent 7af2441 commit c8a76ab
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions loopy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/* Plugin Name: loopy
* Plugin URI: https://github.com/drdf/loopy
* Description:
* Version: 0.1.0
* Author: David Ringsdorf
* Author URI: https://davidringsdorf.de/
* License: MIT
* Text Domain: loopy
*/

if (!function_exists('loopy')) {

/**
* loopy
*
* @author: David Ringsdorf <https://davidringsdorf.de/>
* @version 0.1.0
*/
function loopy(WP_Query $wpQuery) {
$wpQuery->rewind_posts();
while ( $wpQuery->have_posts() ) {
$wpQuery->the_post();
yield get_post();
}
wp_reset_postdata();
}
}

0 comments on commit c8a76ab

Please sign in to comment.