ThemeShaper Forums » Thematic

[closed]

set expiration date/time for posts

(1 post)
  • Started 4 years ago by candregg
  • This topic is not resolved
  1. I am trying to adjust the category loop in a Thematic child theme to set an expiration date for -time-sensitive posts.

    Here's the function I cobbled together so far:


    // Set post Expiration Time ( for appearances)

    function remove_categoryloop() {
    remove_action('thematic_categoryloop', 'thematic_category_loop');
    }
    add_action('init', 'remove_categoryloop');

    function my_categoryloop() {
    while (have_posts()) : the_post();
    $expirationtime = get_post_custom_values('expiration');
    if (is_array($expirationtime)) {
    $expirestring = implode($expirationtime);
    }

    $secondsbetween = strtotime($expirestring)-time();
    if ( $secondsbetween > 0 ) {
    // For exemple...
    the_title();
    the_excerpt();
    }

    ?><div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>">
    <?php thematic_postheader(); ?>
    <div class="entry-content">
    <?php thematic_content(); ?>

    </div>
    <?php thematic_postfooter(); ?>
    </div><!-- .post -->

    <?php endwhile;
    }
    add_action('thematic_categoryloop', 'my_categoryloop');


    I added a custom filed called 'expiration' to the post, and gave it an expire date/time of '08/19/2010 20:00:00'.

    So far, it's not working, but at least it hasn't broken anything yet. My php is lame, at best, so any help would be appreciated.

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.