[Resolved] Post Last Modified Date

Home Forums Support [Resolved] Post Last Modified Date

Home Forums Support Post Last Modified Date

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1645906
    Jatin

    If i modify a post then i want to show the date modify how can i show natively using GeneratePress theme.
    Does the theme provide any option natively. I dont want to use third party plugins.

    #1645980
    Leo
    Staff
    Customer Support

    Hi there,

    Does this help?
    https://docs.generatepress.com/article/show-the-updated-post-date/

    Let me know ๐Ÿ™‚

    #1646676
    Jatin

    Hey Leo,

    I created a short code and added to the header element which works fine.

    I want to align it on the extreme right bottom of my header element with the same style as other meta elements on the post to make it look nicer. Please let me know if its possible.

    + It just shows the date and does not show Last Updated on:
    . How to add this text before the date modified.
    example link in info box.

    #1646744
    David
    Staff
    Customer Support

    Hi there,

    you will need to add some HTML to your Shortcode date:

    function post_modified_date() {
        $modifiedDate = get_the_modified_date();
        $html = '<span class="hero-date">' . $modifiedDate . '</span>';
        return $html;
    }
    add_shortcode( 'modified_date', 'post_modified_date' );

    then you can use some CSS to float the element:

    .hero-date {
        float: right;
    }
    #1646817
    Jatin

    This did worked but not as per the requirements:

    > I want to have the style similar to other meta like Author Name, Date etc.
    > To move the Date Modified to align right as shown in screenshot or in the same row as other meta if possible.
    > have prefix: Last Updated:

    #1647351
    Ying
    Staff
    Customer Support

    Hi Jatin,

    Give this CSS a try:

    .hero-meta {
        display: flex;
        flex-flow: row wrap;
    }
    .hero-meta .hero-date {
        background-color: #fff;
        color: #000;
        margin-left: 10px;
        border-radius: 1px;
        padding: 0px 5px;
    }
    .hero-meta .hero-date:before {
        content: "Last Updated: ";
    }

    Let me know ๐Ÿ™‚

    #1647809
    Jatin

    Thanks much better now but how to extrem align it right hand side, it’s currently displaying next to other meta but I want to separate this one by aligning right.

    #1647956
    David
    Staff
    Customer Support

    Update this CSS and include the line i have commented:

    .hero-meta .hero-date {
        background-color: #fff;
        color: #000;
        margin-left: 10px;
        border-radius: 1px;
        padding: 0px 5px;
        margin-left: auto; /* add this property */
    }
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.