Displaying events as well as other posts on homepage
-
Hi,
I’m trying to display all post types on my home page but am struggling when it comes to my events.
I have used query posts but that is duplicating events over and over. I can see what I have done wrong – I am using [events_list] and I assuming that is creating a double loop.
<?php query_posts( array( 'post_type' => array( 'post', 'event' ), 'showposts' => 8 ) ); ?> <?php while ( have_posts() ) : the_post(); ?> <?php if ( 'post' == get_post_type() ) : ?> <article class="newsPost bit-4"> <h1><a href="<?php the_permalink(); ?> "><?php the_title(); ?></a></h1> <p><?php echo get_excerpt(); ?></p> <p class="postedOn"><?php ccmac_posted_on(); ?></p> </article> <?php endif; ?> <?php if ( 'event' == get_post_type() ) : ?> <?php echo do_shortcode( '[events_list] <article class="bit-4 #_CATEGORYNAME"> <h1 class="eventListTitle">#_EVENTLINK</h1> <p>#_EVENTEXCERPT{12,...} <a href="#_EVENTURL">Event details</a></p> <data class="date" data-time="#{Y-m-d}">#_{dS F} #@_{- dS F} #_{Y}</data> </article> [/events_list]' ); ?> <?php endif; ?> <?php endwhile; ?>
Can anyone suggest an alternative?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Displaying events as well as other posts on homepage’ is closed to new replies.