/* Custom Change Post per Page */ function custom_change_post_per_page( $attr, $name, $category ) { switch ($name) { case 'jnews_category_': /* For Category Page */ $attr['pagination_number_post'] = 20; $attr['number_post'] = 20; break; case 'jnews_archive_': /* For Archive Page */ $attr['pagination_number_post'] = 30; $attr['number_post'] = 30; break; case 'jnews_author_': /* For Author Page */ $attr['pagination_number_post'] = 15; $attr['number_post'] = 15; break; } return $attr; } add_action( 'jnews_get_content_attr', 'custom_change_post_per_page', 99, 3 ); function custom_change_post_per_page_by_pre_get_posts( $query ) { if ( is_search() ) { /* For Search Page */ $query->set( 'posts_per_page', 5 ); } } add_action( 'pre_get_posts', 'custom_change_post_per_page_by_pre_get_posts', 99 );