WordPress.org

Ready to get started?Download WordPress

Forums

different template regarding to post id or date? (3 posts)

  1. veronique-m
    Member
    Posted 8 years ago #

    I'd like to change my template but would like that the posts published before the swap remain on the old template... any ideas ?

    thanks!

  2. schestowitz
    Member
    Posted 8 years ago #

    This would be very hard to achieve. You will need to hack the WordPress code to do this. I thought about this before, but it has many reasons to be avoided. What'll happen if you display various items together and each one inhereits a different theme? Thoughts to ponder...

  3. veronique-m
    Member
    Posted 8 years ago #

    ok, then, if not different theme, at least different style

    i've just found this:

    Date-Based Differences

    If someone browses our site by date, let's distinguish posts in different years by using different colors:


    <?php
    // this starts The Loop
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <h2 id="post-<?php the_ID(); ?>">
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?>
    </h2>
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    <?php
    // are we showing a date-based archive?
    if (is_date())
    {
    if (date('Y') != get_the_date('Y'))
    {
    // this post was written in a previous year
    // so let's style the content using the "oldentry" class
    echo '<div class="oldentry">';
    } else {
    echo '<div class="entry">';
    }
    } else {
    echo '<div class="entry">';
    }
    the_content('Read the rest of this entry ยป');
    ?>
    </div>

    http://codex.wordpress.org/Conditional_Tags#Date-Based_Differences

Topic Closed

This topic has been closed to new replies.

About this Topic