Advertisement
arie_cristianD

shoe all post in archive page and delete the pagination

Mar 3rd, 2024 (edited)
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. /*  delete pagination in category page */
  2. add_filter( 'jnews_get_content_attr', 'remove_category_pagination', 99, 3 );
  3.  
  4. function remove_category_pagination( $attr, $category_page, $term_id ) {
  5.     if ( 'jnews_category_' === $category_page ) {
  6.         $attr['number_post']     = -1;
  7.         $attr['pagination_mode'] = 'disable';
  8.     }
  9.     return $attr;
  10. }
  11.  
  12. /*  delete pagination in Tag archive page */
  13. function delete_pagination_all_archive( $query ) {
  14.     if ( is_archive() && $query->is_main_query() ) {
  15.         $query->set( 'posts_per_page', -1 );
  16.         $query->set( 'nopaging', true );
  17.     }
  18. }
  19.  
  20. add_action( 'pre_get_posts', 'delete_pagination_all_archive' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement