1. Go to this page and download the library: Download wp-forge/wp-loop 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/ */
wp-forge / wp-loop example snippets
foreach ( wp_loop() as $post ) {
$query = new WP_Query( [ 'post_type' => 'post' ] );
foreach ( wp_loop( $query ) as $post ) {
$query = new WP_Query( [ 'post_type' => 'post' ] );
$iterator = new ArrayIterator( $query->posts );
foreach ( wp_loop( $iterator ) as $post ) {
if( have_posts() ) {
// For global query approach
}
if( $query->have_posts() ) {
// For custom query approach
}
if( ! empty( $posts ) ) {
// For post or post ID approach
}
if( $iterator->valid() ) {
// For iterator approach
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.