We have an issue with the calendar not displaying the calendar when clicking in the date field. I tried replacing the widget with a shortcode but it still doesn’t work. Here is the link to the relevant page : https://restaurantalamaison.fr/reservation/
Thanks in advance,
Greetings.
WordPress 6.6.2
Php 8.0
Theme Laurent
]]>This page doesn’t seem to exist.It looks like the link pointing here was faulty. Maybe try searching?
although the navigation bar has the correct address showing “mysite.local/events-calendar/?month=1&year=2025”
from November 2024, i can easily go to December 2024 by pressing next month button, but after that its error.
can anyone help?
this is my code:
// Shortcode for calendar month view
add_shortcode('calendar_month_view', 'display_calendar_month_view');
function display_calendar_month_view() {
? ? ob_start();
? ? // Get the current month and year from URL parameters or default to the current date
? ? $current_month = isset($_GET['month']) ? (int)$_GET['month'] : date('n');
? ? $current_year = isset($_GET['year']) ? (int)$_GET['year'] : date('Y');
? ? // Adjust month and year for navigation
? ? if ($current_month < 1) {
? ? ? ? $current_month = 12;
? ? ? ? $current_year--;
? ? } elseif ($current_month > 12) {
? ? ? ? $current_month = 1;
? ? ? ? $current_year++;
? ? }
? ? // Calculate the number of days and starting weekday of the month
? ? $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
? ? $first_day_of_month = strtotime("$current_year-$current_month-01");
? ? $first_weekday = date('w', $first_day_of_month);
? ? // Days of the week header
? ? $days_of_week = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
? ? echo '<div class="calendar-navigation">';
? ? // Previous Month link
? ? $prev_month = $current_month - 1;
? ? $prev_year = $current_year;
? ? if ($prev_month < 1) {
? ? ? ? $prev_month = 12;
? ? ? ? $prev_year--;
? ? }
? ? echo '<a href="?month=' . $prev_month . '&year=' . $prev_year . '">Previous Month</a>';
? ? // Current Month and Year label
? ? echo '<span>' . date('F Y', $first_day_of_month) . '</span>';
? ? // Next Month link
? ? $next_month = $current_month + 1;
? ? $next_year = $current_year;
? ? if ($next_month > 12) {
? ? ? ? $next_month = 1;
? ? ? ? $next_year++;
? ? }
? ? echo '<a href="?month=' . $next_month . '&year=' . $next_year . '">Next Month</a>';
? ? echo '</div>';
? ? echo '<div class="calendar-grid">';
? ? // Print days of the week
? ? foreach ($days_of_week as $day) {
? ? ? ? echo '<div class="calendar-day-header">' . $day . '</div>';
? ? }
? ? // Create empty boxes for the first week
? ? for ($i = 0; $i < $first_weekday; $i++) {
? ? ? ? echo '<div class="calendar-day empty"></div>';
? ? }
? ? // Loop through each day of the month
? ? for ($day = 1; $day <= $days_in_month; $day++) {
? ? ? ? $date_string = "$current_year-$current_month-$day";
? ? ? ? $posts = get_posts(array(
? ? ? ? ? ? 'post_type' => 'post',
? ? ? ? ? ? 'meta_query' => array(
? ? ? ? ? ? ? ? array(
? ? ? ? ? ? ? ? ? ? 'key' => 'event_start_date',
? ? ? ? ? ? ? ? ? ? 'value' => $date_string,
? ? ? ? ? ? ? ? ? ? 'compare' => '<=',
? ? ? ? ? ? ? ? ? ? 'type' => 'DATE'
? ? ? ? ? ? ? ? ),
? ? ? ? ? ? ? ? array(
? ? ? ? ? ? ? ? ? ? 'key' => 'event_end_date',
? ? ? ? ? ? ? ? ? ? 'value' => $date_string,
? ? ? ? ? ? ? ? ? ? 'compare' => '>=',
? ? ? ? ? ? ? ? ? ? 'type' => 'DATE'
? ? ? ? ? ? ? ? )
? ? ? ? ? ? ),
? ? ? ? ));
? ? ? ? echo '<div class="calendar-day">';
? ? ? ? echo '<strong>' . $day . '</strong>';
? ? ? ? if ($posts) {
? ? ? ? ? ? // Define an array to hold colors for each unique event
? ? ? ? ? ? $event_colors = [];
? ? ? ? ? ? $colors = ['#FFB3B3', '#B3CFFF', '#B3FFB3', '#FFEBB3', '#D7B3FF', '#FFB3D7', '#B3FFDA', '#FFFAB3', '#B3B3FF', '#FFB3B3']; // Add more pastel colors if needed
? ? ? ? ? ? foreach ($posts as $post) {
? ? ? ? ? ? ? ? setup_postdata($post);
? ? ? ? ? ? ? ? $title = get_the_title($post);
? ? ? ? ? ? ? ? $truncated_title = mb_substr($title, 0, 20);
? ? ? ? ? ? ? ? $post_link = get_permalink($post->ID);
? ? ? ? ? ? ? ? $post_content = get_the_content(null, false, $post); // Get the full post content
? ? ? ? ? ? ? ? $image_from_content = get_first_image_from_content($post_content); // Get the first image
? ? ? ? ? ? ? ? // Use post ID as the unique key for color assignment
? ? ? ? ? ? ? ? $unique_key = $post->ID;
? ? ? ? ? ? ? ? // Assign a unique color based on the hash of the post ID
? ? ? ? ? ? ? ? if (!isset($event_colors[$unique_key])) {
? ? ? ? ? ? ? ? ? ? $index = $unique_key % count($colors); // Ensure unique color assignment based on post ID
? ? ? ? ? ? ? ? ? ? $event_colors[$unique_key] = $colors[$index];
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? $event_color = $event_colors[$unique_key]; // Get the assigned color
? ? ? ? ? ? ? ? echo '<div class="event" style="background-color: ' . esc_attr($event_color) . '; cursor: pointer;">';
? ? ? ? ? ? ? ? echo '<a href="' . esc_url($post_link) . '" style="text-decoration: none; color: inherit;">';
? ? ? ? ? ? ? ? echo '<span>' . esc_html($truncated_title) . '</span>';
? ? ? ? ? ? ? ? echo '</a>';
? ? ? ? ? ? ? ? echo '<div class="tooltip" style="z-index: 9999;">';
? ? ? ? ? ? ? ? echo '<a href="' . esc_url($post_link) . '" style="text-decoration: none; color: inherit;">';
? ? ? ? ? ? ? ? if ($image_from_content) {
? ? ? ? ? ? ? ? ? ? echo '<img src="' . esc_url($image_from_content) . '" style="width: 100%; height: auto; object-fit: contain;">'; // Use object-fit
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? echo '<strong>' . esc_html($title) . '</strong>';
? ? ? ? ? ? ? ? echo '</a>';
? ? ? ? ? ? ? ? echo '</div>';
? ? ? ? ? ? ? ? echo '</div>';
? ? ? ? ? ? }
? ? ? ? ? ? wp_reset_postdata();
? ? ? ? }
? ? ? ? echo '</div>';
? ? }
? ? echo '</div>';
? ? return ob_get_clean();
}
]]>My client just wanted to say, Business networking mixer Thursday evening at this pub,” or something equally simple. I needed a plugin for a basic event listing that I could setup easily and then build a small cheat sheet for my client to carry on from. This plugin solved the problem.
Thank you.
]]>I am having trouble with the calendar of my Booking Form. It is not rendering at all. There 2 errors in the console
Uncaught TypeError: jQuery(…).wpbc_timeselector is not a function at wpbc_hook__init_timeselector (wpbc_time-selector.js?ver=10.6.5:108:40) at HTMLDocument. (wpbc_time-selector.js?ver=10.6.5:124:2) at e (jquery.min.js?ver=3.7.1:2:27028) at t (jquery.min.js?ver=3.7.1:2:27330)
Uncaught TypeError: jQuery(…).datepick is not a function at wpbc_calendar_show (wpbc_cal.js:104:1) at HTMLDocument. (book-an-appointment/:397:1405) at e (jquery.min.js:2:27028) at t (jquery.min.js:2:27330)
]]>Can you help me how to make the geolocalisation appear on the calendar functions?
On sportpress settings tab games, there is possibility to select show match, show venue ecc, but it seems that these settings are not reflected on calendar.
Thanks in advance.
this plugin works really well for me but I wish there was a way to avoid loading content from Google servers on the front-end as that always introduces an issue with privacy, repectively GDPR compliance. There are some countries (Germany for example) where the use of any such scripts is still somewhat of a grey area…
At any rate, I just thought I’d spark the idea, maybe there’s some desire to look into it. Proxying these requests would certainly add to the value of the plugin.
All the Best,
SVT