Home › Forums › Calendar Products › Events Calendar PRO › Export Classes
- This topic has 3 replies, 2 voices, and was last updated 7 years, 8 months ago by
Charmaine Taylor.
-
AuthorPosts
-
August 23, 2018 at 7:45 pm #1604660
Charmaine Taylor
ParticipantWe currently have an issue that has no good solution. The Search feature on our website searches the entire site for the queried words. Because of this, the Search feature is finding old classes which include the searched words. For example, if I search on Reiki, the system finds Reiki classes that were added to the calendar years ago. And, it lists the oldest classes first. Is there a way to maintain our history of classes but not have them searchable? Also, is there an export feature that would allow us to export the old classes if we have to delete them?
August 27, 2018 at 9:26 am #1606698Sky
KeymasterHi there,
Thanks for reaching out. I’d be happy to help with your questions.
You can address this with the following snippet:
add_action( 'pre_get_posts', 'my_pre_get_posts' );
function my_pre_get_posts($query) {
if (!is_admin() && $query->is_main_query()) {
if ($query->is_search) {
$meta_query = array();
$meta_query[] = array(
'key' => '_EventStartDate',
'value' => date('Y-m-d').' 00:00:00',
'compare' => '>=',
'type' => 'DATETIME'
);
$query->set('meta_query', $meta_query);
}
}
return $query;
}
Just add that to your child-theme’s functions.php or a functionality plugin.
You can read through the thread where that code was provided here:
There were a few different snippets that worked for different people, but I would start by trying the one I pasted here.
Events can be exported using the default WordPress tools. You can read more about that by visiting this page: https://theeventscalendar.com/knowledgebase/using-wordpress-export-tools-to-migrate-events-content/
Hope that helps! Let me know if that works for you!
Thanks,
SkyAugust 27, 2018 at 3:01 pm #1607040Charmaine Taylor
ParticipantThank you! This solved the problem.
August 28, 2018 at 10:53 am #1607937Sky
KeymasterHi again,
Awesome! Glad that worked for you.
Please let us know if you have any questions or issues in the future.
Thanks,
Sky -
AuthorPosts
- The topic ‘Export Classes’ is closed to new replies.
