PHP code example of johnpbloch / loopable-query
1. Go to this page and download the library: Download johnpbloch/loopable-query library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
johnpbloch / loopable-query example snippets
$featured_posts = new Loopable_Query( new WP_Query( array(
'category_name' => 'featured',
'posts_per_page' => 5,
) ) );
foreach( $featured_posts as $feature ) {
echo '<p><a href="' . get_permalink() . '">';
the_title();
echo '</a></p>';
}