Export Classes

Home Forums Calendar Products Events Calendar PRO Export Classes

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1604660
    Charmaine Taylor
    Participant

    We 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?

    #1606698
    Sky
    Keymaster

    Hi 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:
    https://theeventscalendar.com/support/forums/topic/exclude-past-events-from-wp-search/

    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,
    Sky

    #1607040
    Charmaine Taylor
    Participant

    Thank you! This solved the problem.

    #1607937
    Sky
    Keymaster

    Hi again,

    Awesome! Glad that worked for you.

    Please let us know if you have any questions or issues in the future.

    Thanks,
    Sky

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Export Classes’ is closed to new replies.