views:

97

answers:

3

Hi I have followed a tutorial to create and event list in wordpress using post and Custom Fields view demo

here is my code:

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

Now my problem is that it doesn't show any events for the future events e.g. (June, July etc. ...).

On one of the the discussion there someone had said about putting "In your query_posts, just use the parameter ‘post_status=future’ ".

Can you please let me know exactly where? I have added it but nothing happened.

A: 

According to the query posts docs ( Function Reference/query posts « WordPress Codex ), it goes in your query string &post_status=future like any other parameter. Try a simpler query posts string with &post_status=future and see if it works.

songdogtech
A: 

Custom fields are cool, but I wouldn't suggest using them for a full blown event manager. Consider looking at PodsCMS for WordPress. One of their first working examples is an event manager. The dev team is great and they're always helpful if you ever have problems.

hsatterwhite
thank you.. can this be translated using WMPL
kwek-kwek
Good question. I don't see why not. You can pull Pods data in to any page/post or use Pods to create pod pages and any of these three should work just fine with WPML.
hsatterwhite
A: 

There's also a plugin called The Future Is Now that overrides the default WordPress behavior of not showing posts until their publish date rolls around. Use that and you won't need any custom code to handle this situation.

shacker