WordPress.org

Support

Support » Plugins and Hacks » The Events Calendar » [Resolved] Displaying events on homepage in reverse order

[Resolved] Displaying events on homepage in reverse order

  • Hi,

    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 -->
        <?php
        //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>
                <?php
                $count=0;
                foreach($blog_posts as $post) : setup_postdata($post);
                $count++;
                //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'); ?>
                    </div>
                    <!-- /home-entry-description -->
                </article>
                <!-- /home-entry-->
                <?php
                if($count == '4') { echo '<div class="clear"></div>'; $count=0; }
                endforeach; ?>
            </section>
            <!-- /home-posts -->
        <?php } ?>

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

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

Viewing 1 replies (of 1 total)
  • Plugin Author Barry Hughes

    @websitebakery

    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 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Displaying events on homepage in reverse order’ is closed to new replies.
Skip to toolbar