• Hi,

    I deleted years ago the option for showing the date in my blog and I’m trying to add the last modified date instead.

    Someone suggested to add:

    <?php _e('Last modified  ', 'surplus'); ?><?php if( get_the_modified_date() != get_the_date() ) echo the_modified_date();?>

    I found in my single.php the following and added the code they suggested:

    <article class="post clearfix">
    
    	<header>
            <h1 class="single-title"><?php the_title(); ?></h1>
            <div class="post-meta">
                <span class="awesome-icon-user"></span><?php _e('By', 'surplus'); ?> <?php the_author_posts_link(); ?>
                <span class="awesome-icon-comments"></span><?php _e('With', 'surplus'); ?>  <?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?>
            </div>
          <!-- <div class="post-meta">
            <span class="awesome-icon-calendar"></span><?php _e('On','surplus'); ?> <?php the_time('j'); ?> <?php the_time('M'); ?>, <?php the_time('Y'); ?>
            </div> -->
            <!-- /loop-entry-meta -->

    This worked on every post page, but on the post template now is showing the date the post was created. Does someone know what I can add or change it here also to show only the last modified date:

    Template-blog.php

    <?php
    /**
     * @package WordPress
     * @subpackage Adapt Theme
     * Template Name: Blog
     */
    ?>
    
    <?php get_header(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <header id="page-heading">
    	<h1><?php the_title(); ?></h1>
    </header>
    
    <div class="post clearfix">
    
    <?php
    
    query_posts(
                array(
                'post_type'=> 'post',
                'posts_per_page'=> '6',
                'paged'=>$paged
            ));
    
        ?>
    	<?php if (have_posts()) : ?>
            	<?php get_template_part( 'loop', 'entry') ?>
        <?php endif; ?>
    	<?php pagination(); wp_reset_query(); ?>
    
    </div>
    <!-- /post -->
    
    <?php endwhile; ?>
    <?php endif; ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thank you!

  • The topic ‘Template blog show only last modified date’ is closed to new replies.