2017 © Pedro Peláez
 

wordpress-plugin acf-repeater-field-query

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

image

sectsect/acf-repeater-field-query

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  • Wednesday, November 15, 2017
  • by sectsect
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

ACF Repeater Field Query - For Events -

Modify the Query to multiple dates in a post For Advanced Custom Field "Repeater Field"

Features

For each Date and Time set in the Repeater Field, only the scheduled events are output to Archive Page., (*1)

  • The Date and Time set in the Loop Field is outputted as one event.
  • Displayed in order of the most recent event (ASC).
  • Closed events is not outputted.
  • Supply a function for calendar :date:

Requirements

Installation

  1. cd /path-to-your/wp-content/plugins/
  2. git clone git@github.com:sectsect/acf-repeater-field-query.git
  3. Activate the plugin through the 'Plugins' menu in WordPress.
    You can access the some setting by going to Settings -> ACF Repeater Field Query.
  4. Setting Post Type Name, Repeater Field Name, Date Field Name in Loop Feld".
    ( Optional Field: Taxonomy Name, StartTime Field, FinishTime Field )
    That's it:ok_hand:
    The main query of your select post types will be modified.

Fields Structure Example

, (*2)

NOTES

  • Tested on ACF v5.5.5
  • If you want to apply to some existing posts, Resave the post.
  • Supports Page is_date() includes is_year() is_month() is_day().
  • If you have set the 'FinishTime', it does not appear that post when it passes your set time. (Default: The Day Full)

Usage Example

You can get a sub query using the new ACF_RFQ_Query(), (*3)

Example: Sub Query

<?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 ACF_RFQ_Query($args);
?>
<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
    // something
<?php endwhile; ?>
<?php endif;?>
<?php wp_reset_postdata(); ?>

Example: Sub Query For Calendar (Using acf_rfq_calendar())

 -1,
        'calendar'       => true, // For get the data from not today but first day in this month.
    );
    $query = new ACF_RFQ_Query($args);
?>
have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
date));
    array_push($dates, $date);
?>



 $dates,       // (array) (required) Array of event Date ('Ymd' format)
        'months'       => $months,      // (array) (required) Array of month to generate calendar ('Ym' format)
        'weekdayLabel' => 'default',    // (string) (optional) Available value: 'default' or 'en' Note: 'default' is based on your wordpress locale setting.
        'weekdayBase'  => 0,            // (integer) (optional) The start weekday. 0:sunday ~ 6:saturday Default: 0
        'element'      => 'div',        // (string) (optional) The element for wraping. Default: 'div'
        'class'        => ''            // (string) (optional) The 'class' attribute value for wrap element. Default: ''
    );
    acf_rfq_calendar($args);
?>

Example: Sub Query For Calendar (Using Your Calendar Class)

 -1,
        'calendar'          => true     // For get the data from not today but first day in this month.
    );
    $query = new ACF_RFQ_Query($args);
?>
have_posts() ) : while ( $query->have_posts() ) : $query->the_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));
?>




Example: Get the "Date", "StartTime" and "FinishTime"



date)); ?>
<time> <?php echo date("H:i", strtotime($post->starttime)); ?> ~ <?php echo date("H:i", strtotime($post->finishtime)); ?> </time>

function

get_months_from_now($num)

Parameters
  • num (integer) (required) Number of months to get.
    Default: 1
Return Values

(array)
Ym formatted., (*4)

$months = get_months_from_now(3);

acf_rfq_calendar($args)

Parameters
  • dates (array) (required) Array of event Date ('Ymd' format)., (*5)

  • months (array) (required) Array of month to generate calendar ('Ym' format), (*6)

  • weekdayLabel (string) (optional) Available value: 'default' or 'en'.
    Default: 'default'
    :memo: 'default' is based on your wordpress locale setting., (*7)

  • weekdayBase (integer) (optional) The start weekday. 0:sunday ~ 6:saturday
    Default: 0, (*8)

  • element (string) (optional) The element for wraping.
    Default: 'div', (*9)

  • class (string) (optional) The 'class' attribute value for wrap element.
    Default: '', (*10)

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

NOTES for Developer

  • This Plugin does not hosting on the wordpress.org repo in order to prevent a flood of support requests from wide audience.

Change log

See CHANGELOG file., (*11)

Contributing

  1. Create an issue and describe your idea
  2. Fork it
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Publish the branch (git push origin my-new-feature)
  6. Create a new Pull Request
  7. Profit! :white_check_mark:

License

See LICENSE file., (*12)

I also have plugin with the same functionality for Custom Field Suite Plugin., (*13)

CFS Loop Field Query

The Versions

15/11 2017

dev-master

9999999-dev

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

15/11 2017

v1.1.5

1.1.5.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

11/08 2017

v1.1.4

1.1.4.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

10/08 2017

v1.1.3

1.1.3.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

23/07 2017

v1.1.2

1.1.2.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

16/06 2017

v1.1.1

1.1.1.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

05/02 2017

v1.1.0

1.1.0.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

05/02 2017

dev-refactor

dev-refactor

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

03/02 2017

v1.0.1

1.0.1.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater

03/02 2017

v1.0.0

1.0.0.0

Modify the Query to multiple dates in a post For Advance Custom Field 'Repeater Field'.

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3

 

plugin wordpress github acf advance custom field repeater