pustakakoran

Homepage Random Post Code

Mar 15th, 2018
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Tinggal paste kode berikut di functions.php theme:
  2.  
  3. add_action('pre_get_posts', 'my_pre_get_posts');
  4. function my_pre_get_posts($query) {
  5. if ( $query->is_home() && $query->is_main_query() ) {
  6. $query->set('orderby', 'rand');
  7. }
  8. }
RAW Paste Data