• Resolved Joe

    (@sabbathbreaker)


    Hi,

    May I know how to change the post date to latest modified date in the child theme? thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Joe

    (@sabbathbreaker)

    Hi, How do I display the last modified time if the post has been modified, else display posted date. Thanks

    if (get_the_modified_time() != get_the_time())

    Hey,
    You would have to edit template files through a child theme. So in the virtue/templates/post-date.php

    You would have to change the get_the_date codes.

    Kadence Themes

    Thread Starter Joe

    (@sabbathbreaker)

    Hi,
    Is it possible to add inside functions.php instead of post-date.php? Thanks

    No because the function for the date is called in the template. You would have to edit the template to show the modified date. Then if also want the post page to be ordered by modified date you would have to change the whole loop… I’ve not seen that though.

    Kadence Themes

    Thread Starter Joe

    (@sabbathbreaker)

    Hi,

    Is the below code will function properly inside post-date.php? Thanks.

    <div class="postmeta updated">
          <div class="postdate bg-lightgray headerfont" itemprop="datePublished">
    	<?php if (get_the_modified_time() != get_the_time()) : ?>
    		<span class="postday"><?php echo get_the_modified_date('j'); ?></span>
          		<?php echo get_the_modified_date('M Y');?>
    	<?php else: ?>
    		<span class="postday"><?php echo get_the_date('j'); ?></span>
    		<?php echo get_the_date('M Y');?>
    	<?php endif; ?>
        </div>
    </div>
    Thread Starter Joe

    (@sabbathbreaker)

    By the way, may I know how to add the latest modified date beside the author icon under post title? Thanks

    You would have to edit every template that calls a date. So if your talking about the “latest post” module in the theme options > home layout. Then you would have to edit the file templates/home/blog_home.php

    Based on reading the code it looks fine I recommend you test have you not tried it?

    Kadence Themes

    Thread Starter Joe

    (@sabbathbreaker)

    Hi,

    Tested and it works. Just need some assurance from the theme author ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to change the post date to latest modified date’ is closed to new replies.