Advertisement
pusatdata

WP-Trik: Jumlah Post Per Halaman Archieve dan Tags

Apr 23rd, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement