• Resolved Mk

    (@immmukeshpatel)


    How To Show “Last Updated Date” instead Of?Publish Date?in Amp Pages.

    in this Linked Amp Page, You Can See Published Date, We Need Updated Date.

    • This topic was modified 5 months, 1 week ago by Mk.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @immmukeshpatel

    Yes, You can modify the template as you like, please follow the below process

    The process is only applicable if you are using Reader Mode with legacy theme.

    1. Create a /amp/ directory in your current active theme /wp-content/themes/blocksy/amp/

    2. Copy meta-time.php from wp-content/plugins/amp/template/meta-time.php to the newly created directory in theme /wp-content/themes/blocksy/amp/meta-time.php

    3. now modify the newly copied file as by replacing post_publish_timestamp to post_modified_timestamp

    the modified file looks like below:

    <?php
    /**
     * Post date template part.
     *
     * ??????
     * DO NOT EDIT THIS FILE WHILE INSIDE THE PLUGIN! Changes You make will be lost when a new version
     * of the AMP plugin is released. You need to copy this file out of the plugin and put it into your
     * custom theme, for example. To learn about how to customize these Reader-mode AMP templates, please
     * see: https://amp-wp.org/documentation/how-the-plugin-works/classic-templates/
     * ??????
     *
     * @package AMP
     */
    
    /**
     * Context.
     *
     * @var AMP_Post_Template $this
     */
    
    ?>
    <div class="amp-wp-meta amp-wp-posted-on">
    	<time datetime="<?php echo esc_attr( gmdate( 'c', $this->get( 'post_modified_timestamp' ) ) ); ?>">
    		<?php
    		echo esc_html(
    			sprintf(
    				/* translators: %s: the human-readable time difference. */
    				__( '%s ago', 'amp' ),
    				human_time_diff( $this->get( 'post_modified_timestamp' ), time() )
    			)
    		);
    		?>
    	</time>
    </div>
    

    Once the change has done, your AMP pages will get display last updated date instead of published date.

    We hope this helps!

    Thread Starter Mk

    (@immmukeshpatel)

    thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.