PHP code example of sectsect / cfs-loop-field-query

1. Go to this page and download the library: Download sectsect/cfs-loop-field-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/ */

    

sectsect / cfs-loop-field-query example snippets


$months = get_months_from_now( 3 );

$args = array(
	'dates'        => $dates,
	'months'       => $months,
	'weekdayLabel' => 'default',
	'weekdayBase'  => 0,
	'element'      => 'div',
	'class'        => 'myclass'
);
cfs_lfq_calendar( $args );
 php

    $ary     = array();
    $page    = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    $perpage = 10;
    $offset  = ( $page - 1 ) * $perpage;
    $args    = array(
        'posts_per_page' => $perpage
    );
    $query = new CFS_LFQ_Query( $args );
 php
$ary     = array();
$args    = array(
    'posts_per_page' => -1,
    'calendar'       => true		// Get the data for Not from the day but from the first day of the month.
);
$query = new CFS_LFQ_Query( $args );
if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post();
    $date    = date( 'Ymd', strtotime( $post->date ) );
    $post_id = $post->ID;
    $perm    = get_the_permalink();
    $title   = get_the_title();
    array_push( $ary, array('date' => $date, 'id' => $post_id, 'permlink' => $perm, 'title' => $title) );
}}
wp_reset_postdata();

// Passing array to your Calendar Class.
 php
<div id="date">
     echo date( 'Y-m-d', strtotime( $post->date ) );