SHARE
TWEET

WP-Trik: Jumlah Post Per Halaman Archieve dan Tags

pustakakoran Apr 23rd, 2017 (edited) 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Ini untuk Keseluruhan (satu setingan untuk semua)
  2.  
  3. Ini untuk ARCHIEVE:
  4.  
  5. function wpsites_query( $query ) {
  6. if ( $query->is_archive() && $query->is_main_query() && !is_admin() ) {
  7.         $query->set( 'posts_per_page', 100 );
  8.     }
  9. }
  10. add_action( 'pre_get_posts', 'wpsites_query' );
  11.  
  12.  
  13. Ini untuk TAGS:
  14.  
  15. function tagwpsites_query( $query ) {
  16. if ( $query->is_tag() && $query->is_main_query() && !is_admin() ) {
  17.         $query->set( 'posts_per_page', 100 );
  18.     }
  19. }
  20. add_action( 'pre_get_posts', 'tagwpsites_query' );
  21.  
  22.  
  23. =================
  24.  
  25. ini per bagian:
  26. function num_posts_archive_project_ie($query) {
  27.     if (!is_admin() && $query->is_archive('projects-ie') && $query->is_main_query()) {
  28.             $query->set('posts_per_page', 6);
  29.    }
  30.     return $query;
  31. }
  32.  
  33. >> projects-ie : nama pages yang diberikan
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top