• Resolved Xenokittten

    (@xenokittten)


    Hi, I love the plugin, but I am wondering if there is any way to hide past events from just the home page, but keep them in other places still? I use a chronological post plugin (so that the focus is on the next closest upcoming event date wise), so having the old events still on the homepage makes the site seem outdated as the oldest event(s) are displayed first. I just want to hide past events from just the homepage, but it would be nice to keep them still “active” elsewhere on the site, so users could comment/upload pics/etc, or for when there’s no events happening, new users can browse past events to get a feel for the types of events we host, etc.

    I found a plugin that can hide certain posts from homepage, but the plugin option doesn’t appear for posts created by this plugin.

    I found code that lets you hide posts by specific categories, but I couldn’t get it to work with this… first, when I use the code as is (and replacing xx with my number as it instructs) – it hides nothing. When I replace the cat with tribe_events_cat and my number in the xx, it hides EVERY thing… I feel like there’s some way to tweak this code that could make it do what I want it do…. but I’m stuck…

    Any help?

    Here is the code:

    function exclude_category($query) {
    if ( $query->is_home() ) {
    $query->set( 'cat', '-xx' );
    }
    return $query;
    }
    add_filter( 'pre_get_posts', 'exclude_category' );

    Can anyone help me tweak the code?

    The page I need help with: [log in to see the link]

  • The topic ‘Hide Past Events From Blog Posts Homepage’ is closed to new replies.