WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Template tag help please (5 posts)

  1. Jonas Grumby
    Member
    Posted 2 years ago #

    I have TEC 2.0.1 running successfully on a site that does not use widgets. I'm looking for the correct code to display a list in the sidebar of titles of the next 5 upcoming events with links to the events. I have read the documentation but have not come up with anything that works. It seems like at the root of it I would need this template tag:

    http://tri.be/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events

    It seems like I have to integrate that tag into something like this example:

    http://codex.wordpress.org/Template_Tags/get_posts#Custom_Post_Type_Category_.28Taxonomy.29

    TIA for any help.

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

  2. Jonas Grumby
    Member
    Posted 2 years ago #

    This is working pretty well so far. I just need to add the links...

    <li><h2 class="widgettitle">Recent Events</h2><ul>
    <?php $args = array( 'post_type' => 'tribe_events', 'posts_per_page' => 5 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    	echo '<li>';
    	the_title();
    	echo '</li>';
    endwhile; ?></ul></li>
  3. Jonas Grumby
    Member
    Posted 2 years ago #

    Got the links in. This seems to work and has title attributes...

    <li><h2 class="widgettitle">Recent Events</h2><ul>
    <?php $args = array( 'post_type' => 'tribe_events', 'posts_per_page' => 5 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?></ul></li>

    Of course you might have to adjust the ul and li tags to fit the styling of your theme. You can also add the

  4. mrozone
    Member
    Posted 2 years ago #

    Thank you for figuring this out!

  5. Jonas Grumby
    Member
    Posted 2 years ago #

    Shane says that the Template Tags will be supported in version 2.0.2 which should be out in a week or two. They actually are not currently supported, which explains why I couldn't get them to work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic