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/
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>
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
mrozone
Member
Posted 6 months ago #
Thank you for figuring this out!
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.