• Resolved nightsun73

    (@nightsun73)


    Hi,

    Is is possible to create custom scopes? I’m looking to impliment a this_weekend scope that includes friday/saturday/sunday.

    I would also like to create a:
    this_week scope that omits today
    this-month scope that omits current week
    this_year scope that omits current month

    I’m happy to code this up myself if you can pointme in the right direction. I’ve had a poke around in eme_events.php and I have tried to copy and imliment the this_week scope and change the limit dates, but to no avail.

    Thanks
    L

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Franky

    (@liedekef)

    Just use a wider scope and then use a filter to eliminate the events you don’t like. I think the filter eme_event_list_filter should work for you.

    Thread Starter nightsun73

    (@nightsun73)

    Had a think around the problem and found the easiest way to solve it was to write my own shortcode that built your shortcode. I’ll leave it here as it may help others.

    function weekend_func() {

    if (date(‘Y-m-d’, strtotime(‘today’)) == date(‘Y-m-d’, strtotime(‘Friday’))){
    $friday= date(‘Y-m-d’, strtotime(‘today’));
    } else {
    $friday= date(‘Y-m-d’, strtotime(‘Friday’));
    }

    $friday= date(‘Y-m-d’, strtotime(‘today’));
    $sunday= date(‘Y-m-d’, strtotime(‘next Sunday’));
    return “[eme_events scope=” . $friday .”–” . $sunday . ” limit=0 showperiod=daily show_ongoing=0 ]”;
    }
    add_shortcode( ‘this_weekend’, ‘weekend_func’ );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Scope’ is closed to new replies.