需要有关在Wordpress中创建事件列表的帮助


Need Help on create a event listing in Wordpress?

我将遵循本教程http://www.blogmarketingacademy.com/events-list-with-wordpress/试图在一页WordPress网站上制作一个事件列表我遇到了一个问题,只显示"没有安排事件!保持调谐"。但我在WordPress帖子选项卡中有一些事件帖子,并且已经在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>

尝试设置$timecutoff=新日期("Y-m-d");

我认为你必须通过这个创建一个新的日期对象。告诉我它是否有效:)