Created
October 24, 2012 12:51
-
-
Save anonymous/3945881 to your computer and use it in GitHub Desktop.
Calendar template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template name: Calendrier | |
*/ | |
get_header( ); | |
?> | |
<?php | |
global $booking, $wpdb, $wp_query; | |
$annee = $wp_query->query_vars['annee']; // i've added this part to use the new query vars i've created with the permalink structure and it's working | |
$mois = $wp_query->query_vars['mois']; | |
//echo $annee; | |
//echo $mois; | |
$year = $annee ? $annee : date_i18n('Y'); // date_i18n uses current_time when called like this | |
$month = $mois ? $mois : date_i18n('m'); | |
$time = strtotime("{$year}-{$month}-01"); | |
get_header(); | |
?> | |
<div id="primary" class="alone"> | |
<div id="content" class="site-content" role="main"> | |
<div id="wpmudevevents-wrapper"> | |
<h1><?php echo sprintf( | |
__('Evènements pour %s', Eab_EventsHub::TEXT_DOMAIN), | |
date_i18n("F Y", $time) | |
); ?></h1> | |
<div class="wpmudevevents-list"> | |
<?php | |
if (!class_exists('Eab_CalendarTable_EventArchiveCalendar')) require_once EAB_PLUGIN_DIR . 'lib/class_eab_calendar_helper.php'; | |
$wp_query = new WP_Query( | |
array( | |
'post_type' => 'incsub_event', | |
'posts_per_page' => -1 | |
) | |
); | |
// var_dump($wp_query) display every events as needed | |
$renderer = new Eab_CalendarTable_EventArchiveCalendar($wp_query->posts); | |
echo $renderer->get_month_calendar($time); | |
// Not every every posts that belong to the month are displayed and I don't understand why ... | |
?> | |
<div class="event-pagination"> | |
<?php | |
$prev = $time - (28*86400); | |
$next = $time + (32*86400); | |
?> | |
<a href="<?php echo Eab_Template::get_archive_url($prev, true); ?>">Prev</a> | |
<a href="<?php echo Eab_Template::get_archive_url($next, true); ?>">Next</a> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment