Plugin Directory

Changeset 3357920


Ignore:
Timestamp:
09/08/2025 12:57:39 PM (7 months ago)
Author:
dramb
Message:

Add new attribute called days_ahead to cs-events-list to allow the shortcode to specify the number of days ahead to look for events to list. Bump the version to 1.0.6

Location:
cs-integration
Files:
84 added
4 edited

Legend:

Unmodified
Added
Removed
  • cs-integration/trunk/README.md

    r3354836 r3357920  
    44* Requires at least: 6.4
    55* Tested up to: 6.8
    6 * Stable tag: 1.0.5
     6* Stable tag: 1.0.6
    77* License: GPLv2 or later
    88
     
    184184You can use a shortcode parameter for showing a particular number of events:
    185185
    186     [cs-events-list church_name="mychurch" num_results="6"]
     186        [cs-events-list church_name="mychurch" num_results="6"]
     187
     188### Events List is not showing any results
     189
     190    By default the Events List only looks ahead 5 days.  If your future events
     191    are beyond that nothing will show.  So just use the days_ahead attribute:
     192   
     193        [cs-events-list church_name="mychurch" num_results="6" days_ahead="30"]
    187194
    188195### I want to change how the output looks:
     
    202209## Changelog
    203210
     211### 1.0.6
     212
     213**2025-09-08**
     214* Added a new attribute 'days_ahead' to cs-event-list so that you can specify
     215  more than the default 5 days looking ahead for events.  Use like this:
     216
     217    [cs-event-list church_name="mychurch" num_results="5" days_ahead="30"]
     218 
    204219### 1.0.5
    205220
  • cs-integration/trunk/README.txt

    r3354836 r3357920  
    44* Requires at least: 6.4
    55* Tested up to: 6.8
    6 * Stable tag: 1.0.5
     6* Stable tag: 1.0.6
    77* License: GPLv2 or later
    88
     
    186186        [cs-events-list church_name="mychurch" num_results="6"]
    187187
     188= Events List is not showing any results
     189
     190    By default the Events List only looks ahead 5 days.  If your future events
     191    are beyond that nothing will show.  So just use the days_ahead attribute:
     192   
     193        [cs-events-list church_name="mychurch" num_results="6" days_ahead="30"]
     194
    188195= I want to change how the output looks: =
    189196
     
    201208
    202209== Changelog ==
     210
     211= 1.0.6 =
     212
     213**2025-09-08**
     214* Added a new attribute 'days_ahead' to cs-event-list so that you can specify
     215  more than the default 5 days looking ahead for events.  Use like this:
     216
     217    [cs-event-list church_name="mychurch" num_results="5" days_ahead="30"]
    203218
    204219= 1.0.5 =
  • cs-integration/trunk/cs-integration.php

    r3354836 r3357920  
    2020 * Plugin URI:        https://github.com/AlwynBarry/cs-integration
    2121 * Description:       CS Integration provides shortcodes to request and display JSON data from the public JSON ChurchSuite feeds.
    22  * Version:           1.0.5
     22 * Version:           1.0.6
    2323 * Author:            Alwyn Barry
    2424 * Author URI:        https://github.com/AlwynBarry/
  • cs-integration/trunk/public/shortcodes/class-cs-event-list-shortcode.php

    r3257115 r3357920  
    135135 *                          church_name="mychurch" is required - with "mychurch" replaced with your church name
    136136 *                          num_results="10" is strongly advised - int range 0..n; 0=all, 1..n = number of events specificed
    137  *                          TO DO - replace default end date with a number_of_days parameter
     137 *                          By default this only lists dates from within the next 5 days. To override this you
     138 *                          can add the attribute 'days_ahead' (e.g. days_ahead="30") to look ahead further.
     139 *                          Do note, however, that if you have a lot of upcoming events the response can be slow.
    138140 */
    139141function cs_event_list_shortcode( $atts ) {
    140142    // Defaulting the end date to anything decreases the JSON request time considerably
    141     $date = new \DateTime();
    142     $five_days = \DateInterval::createFromDateString('5 days');
    143     $date->add($five_days);
     143    $date = new \DateTime();
     144    if ( isset( $atts[ 'days_ahead' ] ) &&  ( intval( $atts[ 'days_ahead' ] ) > 0 ) ) {
     145        $days_ahead = \DateInterval::createFromDateString( $atts[ 'days_ahead' ] . ' days' );
     146    } else {
     147        $days_ahead = \DateInterval::createFromDateString('5 days');
     148    }
     149    $date->add($days_ahead);
    144150    $atts[ 'date_end' ] ??= $date->format( 'Y-m-d' );
    145151    return ( new Cs_Event_List_Shortcode( $atts ) )->run_shortcode();
Note: See TracChangeset for help on using the changeset viewer.