• Resolved raybeam

    (@raybeam)


    Hi, thanks for your plugin. Before I really want to use your plugin, I would like to know if it’s possible to create a custom loop for the events? I’m guessing it is but would like to check. I have a very distinct design to follow and therefore can’t just plugin a shortcode with preconfigured html etc. Would prefer it if I can write a loop for the post type that includes the useful data. For the most part I just want to show 3 events on the home page with title and link and one upcoming event. For the main events page I’d be ok to go with the out of the box look and work from that.

    In short, all I need to know is (probably can find this from digging through the code), what is the post type name? Again, I think I have answered my own question here but of you can confirm or give me a tip that would be great.

    Thanks

    https://wordpress.org/plugins/the-events-calendar/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @raybeam,

    Thanks for getting in touch! The conditional is_singular('tribe_events') may work for what you’re describing–give it a try and let us know if you should run into any issues as you go!

    Thank you!

    Thread Starter raybeam

    (@raybeam)

    Thanks, but that wasn’t quite what I was looking for. What I did in the end in case anyone else is trying to do this is:

    <?php $args = array(
    			'post_type' => 'tribe_events',
    			'posts_per_page' => 3
    		); 
    
    $query = new WP_Query($args);
    if($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?>
     // do custom template stuff here
    <?php endwhile; endif; wp_reset_postdata(); ?>

    So my problem is partially solved but I have a unique scenario where I want to show recent events, not just upcoming events. How can I do that?

    Hey @raybeam,

    Does the article I linked to in your other thread help with this as well?

    https://wordpress.org/support/topic/how-can-i-display-past-events-in-a-custom-loop?replies=2

    Following the examples of how to use tribe_get_events() will allow you to show both past and upcoming events together.

    Thanks!
    Geoff

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create a custom loop for events’ is closed to new replies.