WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
shortcode with a range of days and select category (16 posts)

  1. solomax
    Member
    Posted 2 years ago #

    is there a shortcode so I can select a category and select the current day with a range of 7 days.

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    yes, see http://wp-events-plugin.com/documentation/shortcodes/

    i believe there's a this-week scope

  4. solomax
    Member
    Posted 2 years ago #

    Accepted Arguments : future, past, today, tomorrow, month, next-month, 1-months, 2-months, 3-months, 6-months, 12-months, all

    :(

  5. agelonwl
    Member
    Posted 2 years ago #

    try this by adding to your theme functions.php

    By using a shortcode:
    [events_list scope="this-week"]

    add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2);
    function my_em_scope_conditions($conditions, $args){
    	if( !empty($args['scope']) && $args['scope'] == 'this-week' ){
    		$start_date = date('Y-m-d', strtotime('Last Monday', time()));
    		$end_date = date('Y-m-d', strtotime('Next Sunday', time()));
    		$conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))";
    	}
    	return $conditions;
    }
  6. solomax
    Member
    Posted 2 years ago #

    agelonwl you are a hero

  7. solomax
    Member
    Posted 2 years ago #

    agelonwl can I send you a personal message?

  8. solomax
    Member
    Posted 2 years ago #

    agelonwl I have added your code to the functions.php and when I add 1 recurrent event to a category the event appears twice.

    I use the shortcode like :

    [events_list category="41" scope="this-week"]

    How can I resolve this?

  9. agelonwl
    Member
    Posted 2 years ago #

    can you try to change this line

    $start_date = date('Y-m-d', strtotime('Last Monday', time()));
    to

    $week_number = date('w');
    $start_date = date("Y-m-d",time() - ($week_number - 1)*ONE_DAY);

    do you have a sample link?

  10. solomax
    Member
    Posted 2 years ago #

    that's it..... fantastic

  11. agelonwl
    Member
    Posted 2 years ago #

    that's great.

  12. solomax
    Member
    Posted 2 years ago #

    hi agelonwl,

    after looking at the above code you wrote I came to the conclusion this is not what I want.

    Because when I look on the website on wednesday, this query doesn't show the events previous to wednesday.

    I want to show all days of the week. Actually only the coming events for the current day and coming 6 days
    please help.

    thanks

  13. agelonwl
    Member
    Posted 2 years ago #

    Hi,

    do you have a sample link with sample events?

  14. solomax
    Member
    Posted 2 years ago #

    http://www.vanrheenensport.nl/budo-sport-almere/karate-almere/

    everything works fine now but when we reach thursday you wont see the previous days.

  15. agelonwl
    Member
    Posted 2 years ago #

    Am going to try this and update you.

  16. solomax
    Member
    Posted 2 years ago #

    any idea yet?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic