Both codes are written to work from your theme functions.php file.
Javascript implementation:
add_action('wp_footer', function() { ?> <script type="text/javascript"> (function ($) {
if (typeof $.stecExtend !== 'function') { return; }
var hook = 'onAddToEventsPool'; // Trigger extensions after the events have been added to the calendar
$.stecExtend(function (m) { var calData = m.calData;
var startDate = new Date(2019, 7, 1); // Range start. Note months in js are between 0-11; var endDate = new Date(2019, 7, 31); // Range end. Note months in js are between 0-11; var includeUnapproved = false; // Include unapproved events to the list. True / False var events = calData.getEvents(startDate, endDate, includeUnapproved); // Retrieves events, takes rrule into account
// If has events if (events && events.length > 0) { // Loop each event $.each(events, function () { var event = this;
var eventTitle = event.title; // ... // ... // ...
console.log(event); // Display each event properties in the browser console }); }
}, hook);
})(jQuery); </script> <?php });
PHP implementation:
add_action('init', function() {
// Set date ranges $start_date = '2019-08-01'; // Range start. Must be database date YYYY-MM-DD; $end_date = '2019-08-31'; // Range end. Must be database date YYYY-MM-DD; $params = array(); $params['meta_query'] = array( 'key' => 'start_date', 'value' => array($start_date, $end_date), // Note does not take into account the repeater since the rrule is generated by js 'compare' => 'BETWEEN', 'type' => 'DATE' );
// Query the events $events = \Stachethemes\Stec\Events::get_events($params);
if ($events && is_array($events)) {
foreach ($events as $event) { if (false === ($event instanceof \Stachethemes\Stec\Event_Post)) { continue; }
$event_title = $event->get_title(); // ... // ... // ... }
// Prints event object methods echo '<pre>'; print_r(get_class_methods($event)); echo '</pre>';
unset($event); } });
Ensure $start_date and $end_date are type string and not arrays.
$start_date = '2019-08-01'; // Range start. Must be database date YYYY-MM-DD; $end_date = '2019-08-31'; // Range end. Must be database date YYYY-MM-DD;
I'm trying to list events in the drop-down menu below the months. How can I do it ?
It should be like the second image.
Pls Reply
Good morning,
We don't have such design. In our plugin the events will expand when you click on the month if you are using month or week view.
Stachethemes Support
My Time Zone is GMT+3
Envato Profile | Facebook | Twitter | Newsletter | Rate & Review
I don't need it in design.
Help me list all the events in the months on the php side.
Thanks for your answer
I'm sorry, but we don't make such customization requests. You can hire an developer from Envato Studio that do customizations on WordPress items here: https://studio.envato.com/explore/wordpress-customization?&utm_campaign=internal+navigation&utm_content=footernav&utm_medium=codecanyon&utm_source=marketplaces&sort=relevance&page=1
Stachethemes Support
My Time Zone is GMT+3
Envato Profile | Facebook | Twitter | Newsletter | Rate & Review
I've listed all the events, like this.
But I can't fetch the month in which the events belong.
I don't think it's compelling enough to require support.
Please help me =(
Both codes are written to work from your theme functions.php file.
Javascript implementation:
PHP implementation:
Stachethemes Developer
thx for reply =)
i have a little problem.
Warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in \wp-includes\wp-db.php on line 1172Call Stack
Ensure $start_date and $end_date are type string and not arrays.
Stachethemes Developer
i'm sure but doesn't work =(
Could you send me your code?
Stachethemes Developer
Remove this code and place this one in theme functions.php.
Stachethemes Developer
You are the best
It is worked
very thx =)