• Hi frdz,

    I am currently developing an events blog. i am able to display events based on dates. i have three nav tabs–> now running, future, expired. i want to display the number of posts in the tab itself (inspired by killerstartups.com). i am using expiration as custom field for setting expiration date. i tried to use this code in header.php

    `<?php query_posts(get_post_custom_values(‘expiration’)); ?>
    <?php while (have_posts()) : the_post(); ?>

    <?php
    $currentdate = Date(“Ymd”);
    $expirationdate = get_post_custom_values(‘expiration’);

    if (is_array($expirationdate)) {
    $expirestringarray = implode($expirationdate);
    }
    $expirestring = str_replace(“/”,””,$expirestringarray);

    if ( $expirestring > $currentdate ) {
    $count_posts = wp_count_posts();
    }
    endwhile;
    echo “Now Running ( $count_posts )”;
    ?>

  • The topic ‘Post Count for Expired Posts’ is closed to new replies.