WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Incorporate Upcoming Event Into Blog (7 posts)

  1. Cara
    Member
    Posted 2 years ago #

    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/

  2. roberto.c
    Member
    Posted 2 years ago #

    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.

  3. Cara
    Member
    Posted 2 years ago #

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

  4. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    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.

  5. vabmedia
    Member
    Posted 2 years ago #

    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.

  6. Cara
    Member
    Posted 2 years ago #

    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?

  7. roberto.c
    Member
    Posted 2 years ago #

    @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:

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic