在 Wordpress 中创建活动列表时需要帮助吗?
Need Help on create a event listing in Wordpress?
我将按照本教程进行此 http://www.blogmarketingacademy.com/events-list-with-wordpress/ 尝试在单页 WordPress 网站上制作事件列表 我有一个问题只显示 "No Events Scheduled! Stay Tuned." 但我有一些事件 post 在 WordPress post 选项卡中并且已经在 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");
我认为你必须通过这个创建一个新的日期对象。告诉我它是否有效:)
我将按照本教程进行此 http://www.blogmarketingacademy.com/events-list-with-wordpress/ 尝试在单页 WordPress 网站上制作事件列表 我有一个问题只显示 "No Events Scheduled! Stay Tuned." 但我有一些事件 post 在 WordPress post 选项卡中并且已经在 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");
我认为你必须通过这个创建一个新的日期对象。告诉我它是否有效:)