Need Help on create a event listing in WordPress?

I’m going by this tutorial on this http://www.blogmarketingacademy.com/events-list-with-wordpress/ trying to make an event list on a one-page WordPress site I have a problem that just show “No Events Scheduled! Stay Tuned.” but I have some event post in WordPress post tab and already made the custom fields in wordpress

<div class="ShowSection" id="Show">
    <div class="container">
        <div class="wrapper">
            <div class="showtitle">
                <h2>Upcoming | <span style="color:#f0c808;">Show Dates</span></h2>
            </div>
            
              <?php
                $timecutoff = date("Y-m-d");
                $args = array(
                'category_name' => 'events',
                'orderby' => 'meta_value',
                'meta_key' => 'eventsortdate',
                'meta_compare' => '>=',
                'meta_value' => $timecutoff,
                'order' => 'DESC'
                );
                $my_query = new WP_Query($args);
                if ($my_query->have_posts()) : while ($my_query->have_posts()) :
                $my_query->the_post();
                $eventdate = get_post_meta($post->ID, "eventdate", true);
                $eventlocation = get_post_meta($post->ID, "eventlocation", true);
              ?>
            
                <ul class="event-list" id="events">
                    <li>
                        <div class="date"><h2><?php echo $eventdate; ?></h2></div>
                        <div class="main-title-event"><p><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p></div>
                        <div class="main-loction-event"><p><?php $eventlocation; ?></p></div>
                    </li>
                </ul>
            
                <?php endwhile; else: ?>
                    <ul id="events">
                    <li><?php _e('No Events Scheduled! Stay Tuned.'); ?></li>
                    </ul>
                <?php endif; ?>
        </div>
    </div>
</div>

Related posts

1 comment

  1. Try to set
    $timecutoff = new date(“Y-m-d”);

    I think you have to create a new date object through this. Tell me if it worked 🙂

Comments are closed.