• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Front page displays latest updated post

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Front page displays latest updated post

This topic is: resolved

Tagged: genesis_grid_loop_args

  • This topic has 13 replies, 2 voices, and was last updated 8 years, 11 months ago by Brad Dalton.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • December 3, 2016 at 2:38 pm #196954
    jaychan
    Participant

    Hello,

    I use Genesis Simple theme and would like to modify the default reading settings. I would like to display "latest updated posts" instead of "latest posts", everywhere.

    Would there have a way to do it, please?

    Thank you.

    December 4, 2016 at 5:29 am #196964
    Brad Dalton
    Participant

    You can use the orderby parameter for modified

    'orderby' => 'modified'
    

    You can use this with WP_Query or genesis_custom_loop.

    See the page_team.php file in the Infinity Pro child theme for an example.


    Tutorials for StudioPress Themes.

    December 4, 2016 at 5:38 am #196965
    jaychan
    Participant

    Thank you @braddalton

    Based on your suggestion, I found the function:

    add_action( 'genesis_before_loop', 'ntg_do_query' );
    function ntg_do_query() {
    
            global $query_string;
            query_posts( wp_parse_args( $query_string, array( 'orderby' => 'modified', 'order' => 'ASC' ) ) );
    }

    Is that correct?

    Thank you.

    December 4, 2016 at 6:43 am #196969
    Brad Dalton
    Participant

    No. Don't use query_posts.

    Use WP_Query or even better, genesis_custom_loop

    	
    $args = array(
    	'orderby' => 'modified',
    );
    

    See the page_team.php file in the Infinity Pro child theme for a working example you can modify.


    Tutorials for StudioPress Themes.

    December 4, 2016 at 7:18 am #196971
    jaychan
    Participant

    I forgot to mention that I used Genesis Grid Loop: https://wordpress.org/plugins/genesis-grid-loop/

    https://github.com/billerickson/Genesis-Grid/wiki

    Could you please guide me how to archive the result without break the loop?

    Thanks.

    December 4, 2016 at 7:35 am #196972
    Brad Dalton
    Participant

    Try with this filter

    genesis_grid_loop_args
    

    Tutorials for StudioPress Themes.

    December 4, 2016 at 7:39 am #196973
    jaychan
    Participant

    Yes, I first tried:

    function genesis_grid_loop_args() {
          $args = array(
    	'orderby' => 'modified',
    );
    }

    and then:

    function genesis_grid_loop_args() {
          $args = array(
    	'orderby' => 'modified',
    );
    $query = new WP_Query( $args );
    }

    But none working! Did I miss anything?

    Thank you.

    December 4, 2016 at 7:42 am #196974
    Brad Dalton
    Participant

    That's not going to do anything.

    What you need is a custom filter function written and tested

    Or

    Use a better method without the plugin.

    Use column classes for the grid and pre_get_posts to modify the query.


    Tutorials for StudioPress Themes.

    December 4, 2016 at 7:55 am #196976
    jaychan
    Participant
    This reply has been marked as private.
    December 4, 2016 at 8:10 am #196977
    Brad Dalton
    Participant

    Can't see PM's. Please email me if you need to send a PM [email protected]


    Tutorials for StudioPress Themes.

    December 4, 2016 at 8:39 am #196978
    jaychan
    Participant

    Thank you @braddalton

    I tried to do it with Genesis loop but not successful. simplerthansimplest @WP.org just help me solve this. For anyone who need this later:

    add_action( 'pre_get_posts', 'alter_query_to_show_modified_post_first' );
    
    function alter_query_to_show_modified_post_first( $query ) {
    if($query->is_main_query() ) {
    $query->set( 'orderby', 'modified' );
    }
    }
    December 4, 2016 at 9:27 am #196981
    Brad Dalton
    Participant

    Cool. Works with the Genesis Grid Loop?


    Tutorials for StudioPress Themes.

    December 4, 2016 at 9:33 am #196982
    jaychan
    Participant

    Yes, work with the grid. But now I see another issue!

    I've many scheduled posts, when a scheduled post is published, it no longer display at top because the code check 'modified date' of scheduled post, not 'publish date'

    Is there a way for 'latest modified' and 'latest post' to work together?

    Thank you.

    December 4, 2016 at 9:38 am #196988
    Brad Dalton
    Participant

    Check the WP_Query parameters


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Front page displays latest updated post’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble