Support » Plugin: The Events Calendar » [Plugin: The Events Calendar] Incorporate Upcoming Event Into Blog

  • Cara

    (@caracarafrycom)


    I am new to The Event Calendar and have the latest release. Is there a way to have upcoming events automatically post to my blog section. I like that Events and regular Posts are now separate, but it would be helpful if I could perhaps grab three or four upcoming events into my news stream without having to double up on posts. Does anyone know of a way to do this?

    http://wordpress.org/extend/plugins/the-events-calendar/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Cara, you can use this before the loop:

    query_posts( array( 'post_type' => array( 'post', 'tribe_events' ) ) );

    In this way, the events are listed together with your “normal” posts.

    Thread Starter Cara

    (@caracarafrycom)

    Is there anything special I should add to only grab three most recent upcoming events?

    Hi Cara. Yes, you’d need to specify what # of these get pulled in. Perhaps this will help? http://codex.wordpress.org/Function_Reference/query_posts Let me know if not.

    Hey Roberto, I’m getting a huge error when I try using query_posts. My thought was that since this is a custom post type, is there a way of calling a custom post type from within the loop? I’m going to try it, but would like to know from others, in case they’ve tried this.

    Thread Starter Cara

    (@caracarafrycom)

    I can add the events to my main loop but what I was really asking is if there is a way to pull the next three events on the calendar into the primary loop? If I enter all of the events for the school calendar at once, I don’t want all of those events in the main loop at once. I just want the next three upcoming events. Is there a way to do this?

    @clara, maybe it can be useful to use a query like this:

    $latest_post_query = "(SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date LIMIT 2)
        UNION ALL
        (SELECT * FROM $wpdb->posts WHERE post_type = 'tribe_events' ORDER BY post_date LIMIT 3)";
    $latest_posts = $wpdb->get_results($latest_post_query);

    Look for more info here:

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: The Events Calendar] Incorporate Upcoming Event Into Blog’ is closed to new replies.