Support » Fixing WordPress » Archive and child template date problem

  • Hello all

    Currently i’m using a child template for my news section which have same code as archive.php and the code is listed below. The problem is with the dates and posts that are listed for the news and archive. They were differenta and I want the latest archive to be shown for both pages.
    here is the link and you can understand what i want.
    News page:
    Archive Page:

    The archive pages are correct but the child template is wrong.
    Any Idea?

    <?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 10 ) ); ?>
    		<div class="large-12 columns">
    			 <div class="row">
    				<div class="large-4-news columns">
    $archive_year  = get_the_time('Y');
    $archive_month = get_the_time('m');
    $archive_day   = get_the_time('d');
    $previous_day= $archive_day-1;
    $prev2_day= $archive_day-2;
    <?php  $args = array(
        'year'     => $archive_year,
        'monthnum' => $archive_month,
        'day'     => $archive_day
    query_posts( $args ); ?>
    <div class="panel">
    <h5><?php the_time('j. F'); ?></h5>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                             <p><a>"><?php the_title(); ?></a></p>
                            <p><a>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'news-thumb' ); } ?></a></p>
                             <p><?php echo string_limit_words(get_the_excerpt(), 15); ?></p>
    <?php endwhile; else: ?>
    <p><?php _e('No posts for this day'); ?></p>
    <?php endif; ?>
    <?php wp_reset_query(); ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thanks in advance

  • The topic ‘Archive and child template date problem’ is closed to new replies.