Php Wordpress事件列表
您好,我遵循了一个教程,使用post和自定义字段在wordpress中创建事件列表 这是我的密码: 现在我的问题是,它没有显示未来事件的任何事件,例如6月、7月等 在其中一次讨论中,有人说过要输入查询帖子,只需使用参数“post\u status=future”Php Wordpress事件列表,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,您好,我遵循了一个教程,使用post和自定义字段在wordpress中创建事件列表 这是我的密码: 现在我的问题是,它没有显示未来事件的任何事件,例如6月、7月等 在其中一次讨论中,有人说过要输入查询帖子,只需使用参数“post\u status=future” 你能告诉我具体在哪里吗?我已经添加了它,但什么也没有发生。根据查询posts文档,它会像其他任何参数一样进入您的查询字符串&post\u status=future。使用&post\u status=future尝试一个更简单的查询po
你能告诉我具体在哪里吗?我已经添加了它,但什么也没有发生。根据查询posts文档,它会像其他任何参数一样进入您的查询字符串&post\u status=future。使用&post\u status=future尝试一个更简单的查询posts字符串,看看它是否有效。自定义字段很酷,但我不建议将它们用于全面的事件管理器。考虑一下WordPress。他们的第一个工作示例之一是一个。开发团队很棒,如果你遇到问题,他们总是很有帮助。还有一个名为的插件,它覆盖了默认的WordPress行为,即在发布日期之前不显示帖子。使用它,您将不需要任何自定义代码来处理这种情况。好问题。我不明白为什么不。您可以将Pods数据拉入任何页面/帖子,或者使用Pods创建pod页面,这三种方法中的任何一种都可以与WPML配合使用。
<?php // Get today's date in the right format
$todaysDate = date('M d');
?>
<?php query_posts('showposts=5&category_name=events&meta_key=Date&meta_compare=>=&meta_value='.$todaysDate.'&orderby=meta_value=order=ASC'); ?>
<ul>
<?php
if (have_posts()) : while (have_posts()) : the_post();
$eventMeta = get_post_meta($post->ID, 'Date', true);
$eventDate = strtotime($eventMeta);
$displayDate = date ('M d', $eventDate);?>
<li>
<span class="date"><?php echo $displayDate ; ?></span>
<span><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></span>
</li>
<?php endwhile; else: ?>
<li>Sorry, no upcoming events!</li>
<?php endif; ?>
</ul>
<?php wp_reset_query(); ?>