Created
December 15, 2020 12:10
-
-
Save murshed/0dfe3719bc8f2f43071d8bc7719ea156 to your computer and use it in GitHub Desktop.
Random Post Functions for Astra theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function homepage_posts($query) | |
{ | |
if ($query->is_home() && $query->is_main_query()) | |
{ | |
$query->set( 'orderby', 'rand' ); | |
} | |
} | |
add_action('pre_get_posts', 'homepage_posts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment