2010-05-05 33 views
0

您好我都跟着教程創建和事件列表使用後和自定義字段WordPress的view demoWordPress的事件列表

這裏是我的代碼:

<?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(); ?> 

現在我的問題是,它不沒有顯示未來事件的任何事件,例如(六月,七月等...)。

在其中一個討論中,有人提到"In your query_posts, just use the parameter ‘post_status=future’ "

你能讓我確切知道在哪裏嗎?我添加了它,但沒有發生任何事情。

回答

0

自定義字段很酷,但我不會建議將它們用於完整的事件管理器。考慮看看WordPress的PodsCMS。他們的第一個工作實例之一是event manager。開發團隊非常棒,如果您遇到問題,他們總是樂於助人。

+0

謝謝..可以這個翻譯使用WMPL – 2010-05-05 17:25:53

+0

好問題。我不明白爲什麼不。您可以將Pods數據拖入任何頁面/帖子或使用Pods創建Pod頁面,而這三者中的任何一個都可以在WPML下正常工作。 – hsatterwhite 2010-05-05 18:54:12

0

還有一個名爲The Future Is Now的插件,它會覆蓋默認的WordPress行爲,直到他們的發佈日期到來才顯示帖子。使用它,你不需要任何自定義代碼來處理這種情況。