Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Post “Updated on” to reflect ModifiedTime

  • Some time ago I requested support for the same issue and you can see the old topic here:
    https://generatepress.com/forums/topic/post-updated-on-to-reflect-modifiedtime/

    Unfortunately some time ago I noticed it is not working anymore.

    I tried to add this to my child theme functions.php:

    add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );

    but I got this error message:
    Your PHP code changes were rolled back due to an error on line 21 of file wp-content/themes/generatepress_child/functions.php. Please fix and try saving again.

    Uncaught Error: Undefined constant “‘generate_post_date_show_updated_only’” in wp-content/themes/generatepress_child/functions.php:21
    Stack trace:
    #0 wp-settings.php(591): include()
    #1 wp-config.php(94): require_once(‘…’)
    #2 wp-load.php(50): require_once(‘…’)
    #3 wp-admin/admin.php(34): require_once(‘…’)
    #4 wp-admin/theme-editor.php(10): require_once(‘…’)
    #5 {main}
    thrown

    I already have this in my functions.php:

    add_filter( 'generate_post_date_output','tu_add_to_post_date' );
    function tu_add_to_post_date( $output ) {
        return '<span class="date-label">Updated on </span>' . $output;
    }
    
  • Hi there,

    It might be because the wrong quotation mark is used in snippet.

    Try this:
    add_filter( 'generate_post_date_show_updated_only', '__return_true' );

    instead of this:
    add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );

  • Thanks, Leo! Looks like this solved the issue!

  • No problem 🙂

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