Home Forums WoodMart support forum Display updated date & order blog posts by modified date (SEO)

Display updated date & order blog posts by modified date (SEO)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #703295

    Roderik
    Participant

    Hi support team,

    We are currently working on improving our blog SEO and have a question regarding date display and article ordering in Woodmart.

    At the moment, our articles only display the published date on the frontend. However, we would like to align the visible frontend dates and blog ordering with this.

    Specifically, we would like to achieve the following:

    Date display on single blog posts

    Display either:
    1.1 both Published date and Last updated date, or
    1.2 only the Last updated date
    Preferably in a way that avoids duplicate dates when no update has occurred.

    Blog category / archive ordering

    Order blog posts based on Last updated (modified) date, not published date.

    This ensures that updated articles surface to the top of the blog listing, receive more internal links, and that Google properly re-indexes updated content.

    Could you please advise:

    1. Whether Woodmart has built-in settings for this (theme options / customizer)?
    2. If not, what is the recommended and update-safe way to implement this in Woodmart

    We want to make sure this is implemented in a way that remains compatible with future Woodmart updates.

    Thank you in advance for your guidance.

    #703410

    Hello,

    01. You can edit the date of the post in the admin panel; you can set any date, and it will be visible. There is the option in theme settings > blog > Enable or disable the option “Show published date”.

    If you want to show both dates, you need to edit the theme file for this. You can find the code for this in the file inc/template-tags.php. You can edit the theme file at your own risk.

    02. The output of blog posts is a default functionality of WordPress. But there is no such option to change the order of posting posts either in the WordPress settings or in the theme settings.

    So alternatively, try to add the following php code in functions.php of the theme.

    function order_posts_by_modified_date( $query ) {
        if ( ! is_admin() && $query->is_main_query() && ( is_home() || is_archive() ) ) {
            $query->set( 'orderby', 'modified' );
            $query->set( 'order', 'DESC' );
        }
    }
    add_action( 'pre_get_posts', 'order_posts_by_modified_date' );

    Hope this Helps!

    Best Regards,

Viewing 2 posts - 1 through 2 (of 2 total)