• Resolved Alison

    (@zirafa)


    I need to modify the calendar widget so that clicking on the month name at the top of the widget will display a datepicker. On selection of a new date, the user should be redirected to the main calendar page (i.e. events list) with the scope set to show events starting on the selected date, with no set end date. For example, if the user clicked on Dec. 1, 2019, this should redirect to a list of all events from that date forward.

    The main problem here, I think, is figuring out how to modify the $args array before it is loaded by the events-list-grouped.php template.

    So far I’ve got a datepicker input field in place through an override of the calendar-small.php template. This is an excerpt, showing my work-in-progress code:

    <td class="month_name" colspan="5">
        <form action="https://dev.sitename.org/events/" method="post" >
                        
            <span class="em-date-single">
            <input class="em-date-input-loc" type="text" name="test" />
            <input class="em-date-input" type="hidden" name="scope" />
            </span>
            <!--input type="hidden" name="action" value="search_events_grouped" />
            <input type="hidden" name="country" value="" /-->
            <button type="submit" class="em-search-submit loading">
            <!--[if IE 7]><span><![endif]-->
            <img src="https://dev.sitename.org/wp-content/plugins/events-manager/includes/images/search-mag.png" alt="Search" />
            <!--[if IE 7]></span><![endif]-->
            </button>
                        
        </form>
        <?php echo esc_html(date_i18n(get_option('dbem_small_calendar_month_format'), $calendar['month_start'])); ?>
    </td>

    It’s very ugly, and only semi-functional. Currently clicking the submit button brings the user to the main events list page showing future events. The selected date shows up in the start date field of the advanced search form, but the scope displayed is still the default, which is to show all future events.

    Any pointers will be much appreciated!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add Datepicker to calendar widget’ is closed to new replies.