• Resolved MrMyles

    (@mrmyles)


    I am using an old custom built template, works perfect for what we need.
    We just started using this event calendar and would like to display our events alongside our posts feed.

    Our posts feed displays on a couple of pages and is hard coded into our template. It displays posts from a certain category. We would like to include our Tribe Events in that category or expand the code to include Tribe Events.
    Is this possible?

    Our code:

    <?php query_posts('cat=665&showposts=12'); ?>
    
        			<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                        <div class="large-4 medium-4 columns events_wrap">  
                            <li>
                            
                                <?php if(get_field('feature_image')) : ?>
    								<?php $attachment_id = get_field('feature_image'); $size = "front-page-news"; $image = wp_get_attachment_image_src( $attachment_id, $size ); ?>
                                	<img src="<?php echo $image[0]; ?>" alt="Image of <?php the_title(); ?>" class="feature_image"/>
                                <?php else: ?>
                                	<div class="placeholder"><?php echo wp_get_attachment_image( 856, 'front-page-news' ); ?></div>
                                <?php endif ?>
                                
                                <div class="row collapse">
                                    <div class="large-4 medium-4 small-4 columns">
                                    
    									<?php if(get_field('date')) : ?>
                                        <div class="date_posted">
    										<small>Event Date</small>
                                            <?php $date = strtotime(get_field('date')); ?>
                                            <h3><?php echo date('M', $date); ?></h3>                                
                                            <p><?php echo date('d/y', $date); ?></p>
                                        </div>  
                                        <?php else: ?>
                                        <div class="date_posted">
    										<small>Posted On</small>
                                            <h3><?php the_time('M') ?></h3>
                                            <p><?php the_time('j/y') ?></p>
                                        </div>     
                                        <?php endif ?>
                                        
                                    </div>    
                                    <div class="large-8 medium-8 small-8 columns">
    									<p><?php echo excerpt(10); ?></p>
                                        <a href="<?php esc_url( the_permalink() ); ?>" title="Permalink to <?php the_title(); ?>" rel="bookmark">MORE</a>
                                    </div>
                                </div>   
                            </li>
                        </div>
                    <?php endwhile; ?> 
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey there @mrmyles!

    Thanks for reaching out — that’s a great question, I can help with that ??

    You’ll want to take advantage of our helper function tribe_get_events()

    To do what you’re asking, a custom query will need to be crafted — which is something that is beyond the scope of our free support. Our Functions list may help you along the way.

    Good luck!
    Ed ??

    Hey there,

    Since this thread has been inactive for a while, I’m going to go ahead and mark it as resolved. Don’t hesitate to create a new thread any time you help again!

    Ed ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display events using query_posts’ is closed to new replies.