Possible to display three months
-
Is it possible to only display the events of the current month, next month and the month after that?
Kind regards
-
I’ve managed to display the current and next month with the attribute scope. The thing I’m trying to achieve is three columns with events. The third column should display events that will take place in three months from the current date.
Is this possible?
sorry I’m afraid that this is not possible at the moment.
So, I finaly figured out that it’s possible to write your own scope
Unfortunately my code doesn’t work. It’s keeps saying “no events”.
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']=='third-month' ){ $now = time(); $future = strtotime('+2 months', $now); $start_date = mktime(0,0,0,date('m',$future),1,date('y')); $end_date = mktime(0,0,0,date('m',$future)+1,0,date('y')); echo date('d-m-Y', $start_date)," tot " ,date('d-m-Y', $end_date); $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; } add_filter( 'em_get_scopes','my_em_scopes',1,1); function my_em_scopes($scopes){ $my_scopes = array( 'third-month' => 'third month from current date' );
Nevermind. I’ve got it up and running.
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']=='third-month' ){ $start_month_timestamp = strtotime('+2 month', current_time('timestamp')); //get the end of this month + 1 day $start_month = date('Y-m-1',$start_month_timestamp); $end_month = date('Y-m-t',$start_month_timestamp); $conditions['scope'] = " (event_start_date BETWEEN CAST('$start_month' AS DATE) AND CAST('$end_month' AS DATE))"; } return $conditions; } add_filter( 'em_get_scopes','my_em_scopes',1,1); function my_em_scopes($scopes){ $my_scopes = array( 'third-month' => 'Third month from current date' ); return $scopes + $my_scopes; }
Hi Pookster,
where do you place this code to display it in 3 months?
BTW I need to have an event page displays the following:
Brief information about the training activities (text box)
Search Form (on the top of the page)
Locations – Categories – Events List for the next 3 months.Can I geta little bit of support to find out how to do this within Events Manger on the same page.
Lastly I see Turkish Language translation available in the plugin files but I can not see where to activiate.
Thanks in advance for your time and support.
Sedat KARAKAYA
Hi Sedat,
You can easily place the code in the function.php of your theme.
For translation support you probably have the upload a Turkish language pack, but i’m not sure.
You can make a page in your admin and add, for example the following code
[events_list_grouped scope="third-month" mode="monthly" date_format="F Y"] #_EVENTDATES #_EVENTNAME Start: #_24HSTARTTIME #_ATT{Entree} [/events_list_grouped]
See the help for all shortcodes you can use, such as location, categories and eventlist.
Thanks for your response.
Below you will see the functions php of my theme. Please advise how it should be insterted in it. Thanks for your time.
<?php
if ( function_exists(‘register_sidebars’) )
register_sidebars(3);
?><?php
function new_excerpt_length($length) {
return 30;
}
add_filter(‘excerpt_length’, ‘new_excerpt_length’);function new_excerpt_more($more) {
global $post;
return ‘ID) . ‘”>’ . ‘…more’ . ‘‘;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);?>
<?php
add_theme_support( ‘menus’ );
add_action( ‘init’, ‘register_my_menus’ );function register_my_menus() {
register_nav_menus(
array(
‘primary-menu’ => __( ‘Primary Menu’ ),
‘secondary-menu’ => __( ‘Secondary Menu’ ),
‘tertiary-menu’ => __( ‘Tertiary Menu’ )
)
);
} function filter_where($where = ”) {
if ( is_search() ) {
$exclude = array(323,325,327,329);for($x=0;$x<count($exclude);$x++){
$where .= ” AND ID != “.$exclude[$x];
}
}
return $where;
}
add_filter(‘posts_where’, ‘filter_where’);?>
- The topic ‘Possible to display three months’ is closed to new replies.