Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick WP_Query Call
<?php
$args = array('post_type' => 'employment', 'posts_per_page' => 2, 'numberpost' => 2);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<?php echo excerpt(25); ?>
<a href="<?php the_permalink(); ?>">Read More</a>
<?php
endwhile;
wp_reset_query();
wp_reset_postdata();
// Tribe Events Query
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$upcoming = new WP_Query();
$upcoming->query( array('post_type'=> 'tribe_events', 'eventDisplay' => 'past', 'posts_per_page' => 1, 'paged' => $paged));
if ($upcoming->have_posts()) :
while ($upcoming->have_posts()) :
$upcoming->the_post();
?></pre>
<div class="single-event"></div>
<pre> <!--?php <br ?--> endwhile;
if ( function_exists('wp_pagenavi') ) wp_pagenavi( array( 'query' => $upcoming ) ); // tell it which query we are paginating
endif;
wp_reset_query(); // important to reset the query
// Events WP_Query
$args = array(
'post_type' => 'events',
'posts_per_page' => 6,
'meta_query' => array(
array(
'key' => 'be_event_end',
'value' => (int) current_time( 'timestamp' ),
'compare' => '>'
)
),
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_key' => 'be_event_start'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$start = get_post_meta( get_the_ID(), 'be_event_start', true );
$end = get_post_meta( get_the_ID(), 'be_event_end', true );
$event_location = get_field('event_location');
$date = date( 'M d', $start );
$start_time = date( 'g:i a', $start );
$end_time = date( 'g:i a', $end );
endwhile;
?>
</div>
<?php
wp_reset_query();
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.