Skip to content

Instantly share code, notes, and snippets.

@thoronas
Last active August 29, 2015 14:26
Show Gist options
  • Save thoronas/39c9b8a9ac4cc355976f to your computer and use it in GitHub Desktop.
Save thoronas/39c9b8a9ac4cc355976f to your computer and use it in GitHub Desktop.
WP Query for events posts with upcoming dates
<?php
$current_date = date(Ymd);
$event_args = array(
'post_type' => 'event_post_type',
'meta_query' => array(
array(
'key' => 'date_field',
'value' => $current_date,
'compare' => '>='
)
),
);
$events = new WP_Query( $event_args );
// do query loop stuff
?>
@leanneromak
Copy link

image

This is the current code for the field in the tab that gets both past-dated 'upcoming_speaking_engagements' and also 'speaking_engagements' supplied from a separate field:

                <?php if( get_field('speaking_engagements') || get_field('upcoming_speaking_engagements')): ?>
                <li class="sky-tab-content-5">
                    <div class="typography">
                    <?php if( have_rows('upcoming_speaking_engagements') ): ?>
                <?php while( have_rows('upcoming_speaking_engagements') ): the_row(); ?>

                <p style="margin-top:40px;">
                <?php the_sub_field('speaking_engagement_date'); ?>
                <?php the_sub_field('upcoming_speaking_engagement'); ?></p>

                <?php endwhile; ?>
                <?php endif; ?>

                <p style="margin-top:40px;"><?php the_field('speaking_engagements'); ?></p>

                </div>
                </li><?php endif; ?>

I also have to style upcoming_speaking_engagements date separately in the circles below on the page http://ekbdev.wpengine.com/people/angelina-folino/

Not sure how to integrate the query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment