Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cr12-14

    (@cr12-14)

    I tried changing the category to cat and it did not make a difference.

    Thread Starter cr12-14

    (@cr12-14)

    Better?


    <?php
    $args = array('numberposts' => 1, 'category' => 3,'orderby' => 'rand');
    $lastposts = get_posts( $args );

    if ( false === ( $totd_trans_post_id = get_transient( 'totd_trans_post_id' ) ) ) {

    $totd = get_posts($args);
    $midnight = strtotime('midnight +1 day');
    $timenow = time();
    $timetillmidnight = $midnight - $timenow;
    echo $midnight;
    echo ",".$timenow;
    set_transient('totd_trans_post_id', $totd[0]->ID, $timetillmidnight);
    } else {
    $args = array('post__in' => array($totd_trans_post_id));
    $lastposts = get_posts($args);
    }

    foreach( $lastposts as $post ) : setup_postdata($post); ?>

    <div>
    <?php the_content(); ?>
    </div>
    <?php endforeach;
    wp_reset_postdata(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)