The Events Calendar
[resolved] Displaying events on homepage in reverse order (2 posts)

  1. iaingriffin
    Posted 2 years ago #


    I have a feed for my events calendar on my homepage that's kind of working. It pulls in four events, but the oldest ones, not the latest ones. Plus the order of display is oldest (on the left) to newest (on the right).

    I'd like to reverse this so the newest is on the left, and the oldest on the right - with the fifth oldest event dropping off the page automatically.

    Could anyone suggest how I can tweak the code (which I've made amendments to myself already from the original template) to display what I'm after please?

    Hopefully it makes sense and someone can help. Thanks in advance.

    <!-- Recent Blog Posts -->
        //get post type ==> custom posts
            global $post;
            $args = array(
                'post_type' =>'tribe_events',
    			'category' =>'tribe_events_cat',
                'numberposts' => '4'
            $blog_posts = get_posts($args);
        <?php if($blog_posts) { ?>
            <section id="home-posts" class="clearfix">
                <h2 class="heading"><span><?php if(!empty($options['recent_work_text'])) { echo $options['recent_work_text']; } else { _e('Recent Work','adapt'); }?></span></h2>
                foreach($blog_posts as $post) : setup_postdata($post);
                //get portfolio thumbnail
                $feat_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');
                <article class="home-entry <?php if($count == '4') { echo 'remove-margin'; } if($count == '3') { echo ' responsive-clear'; } ?>">
                	<?php if ($feat_img) {  ?>
                    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $feat_img[0]; ?>" height="<?php echo $feat_img[2]; ?>" width="<?php echo $feat_img[1]; ?>" alt="<?php echo the_title(); ?>" /></a>
                    <?php } ?>
                    <div class="home-entry-description">
                        <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo the_title(); ?></a></h3>
                        <?php echo excerpt('25'); ?>
                    <!-- /home-entry-description -->
                <!-- /home-entry-->
                if($count == '4') { echo '<div class="clear"></div>'; $count=0; }
                endforeach; ?>
            <!-- /home-posts -->
        <?php } ?>

    The website is http://www.nzstudies.com


  2. Barry Hughes
    Plugin Author

    Posted 2 years ago #

    Great to see stuff like this being built - though I'm afraid it's beyond the scope of support we can offer here to guide you through this one. We can definitely leave the thread open though, in case another member of the community can jump in with advice :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • The Events Calendar
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic