To limit the events returned by a saved template in WordPress, you can use this code snippet. Add it to your child theme’s functions.php
file or a custom plugin to cap the events at 2 for the specific template ID (1234 in this example).
How to Use
- Replace
1234
with your desired saved template ID. - Set the event limit by changing
2
to your preferred number of events.
This filter targets the ecn_limit_total_output
filter to control the total output limit for the specified template. Adjust the IDs and numbers to match your needs.