[Support request] update post to show on homepage without changing Original post date

Home Forums Support [Support request] update post to show on homepage without changing Original post date

Home Forums Support update post to show on homepage without changing Original post date

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1971633
    Melissa

    I have the Published date AND updated dates showing using a bit of extra css

    CSS
    /* Display updated date */
    .posted-on .updated {
        display: inline-block;
        margin-right: 1em;
    }
    /*Add date prefixes */
    .posted-on .updated:before {
        content: 'Updated: ';
    }
    .posted-on .entry-date:before {
        content: 'Published: ';
    }

    But The dates are wrong. How do I update a post so that it will show on the homepage, but still have the original publish date? Right now, when I update a post, it changes the Published date and the updated date at the same time.
    post date
    For example, this post was originally written in 2015. But it’s displaying as thought I just wrote it a couple of weeks ago.

    #1972062
    David
    Staff
    Customer Support

    Hi there,

    can you share a link to that post so i can see whats going on ?

    #1972098
    Melissa

    @David,
    Thank you for replying. I’ve added a link to my site in the private info box so you can see. I got the original question semi-sorted out. I use wp show posts to generate content and Elements to create an insertion hook. So that takes care of the “display” order on the homepage.

    The still-present issue for me is how the Category page contents are sorted. They still show the original publish date with the newest at the top.

    How do I force the Categories to sort by the Updated/Modified date rather than the original publish date?

    Thanks!

    #1972134
    David
    Staff
    Customer Support

    Are you using any other functions to modify the dates?
    If i check the HTML of the first post, as you pointed out above, the Updated and Published date are identical.

    #1972146
    Melissa

    Are you using any other functions to modify the dates?
    If i check the HTML of the first post, as you pointed out above, the Updated and Published date are identical.

    No, just the stock publish box in wordpress. No plugins or mods.

    publish-box

    #1972150
    Melissa

    Sorted. I solved it by adding a function–>

    function orderby_modified_posts( $query ) {
        if($query->is_category()) {
                $query->set( 'orderby', 'modified' );
           }
    }
    add_action( 'pre_get_posts', 'orderby_modified_posts' );

    Thank you for the assist.

    #1972516
    David
    Staff
    Customer Support

    Glad to hear you got it resolved

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