• Resolved MarionFW

    (@marionfw)


    I’d like to have recent posts on my site, instead of the static page that is shown now.

    The problem is that all events (from The Events Calender by Modern Tribe) are seen as posts, so when I choose ‘latest posts’ for my homepage, I only get events on top, as there are several events planned until december next.

    Is there a way to exclude events from ‘latest posts’ alltogether?

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • pistachoverde

    (@pistachoverde)

    Hi Marion!!
    Try placing the following code snippet into your theme’s functions.php file:

    function exclude_from_search($query) {
    if ($query->is_search) {
    $query->set('post_type', 'post');
    }
    return $query;
    }
    add_filter('pre_get_posts','exclude_from_search');
    Thread Starter MarionFW

    (@marionfw)

    Hi Pistachoverde, sorry to say that it does not work. Any other suggestions?

    Thread Starter MarionFW

    (@marionfw)

    Hi again,
    Luckily I found the solution: I discovered an option in the Events Calendar to exclude events from the loop. Thanks again for advice!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude events from homepage’ is closed to new replies.