@@ -355,9 +355,9 @@ function register_footer_above_sidebar() {
355355 * Adjust the 'blog' (post archive) to show a different number of posts on the first page.
356356 *
357357 * @param WP_Query $query WordPress Query object.
358+ *
358359 * @return void
359360 */
360- add_action ( 'pre_get_posts ' , 'osi_query_offset ' , 1 );
361361function osi_query_offset ( &$ query ) {
362362 if ( ! ( $ query ->is_blog () || is_main_query () ) || is_admin () || is_front_page () || is_archive () || is_404 () ) {
363363 return ;
@@ -376,19 +376,21 @@ function osi_query_offset( &$query ) {
376376 $ query ->set ( 'posts_per_page ' , $ offset + $ ppp );
377377 }
378378}
379+ add_action ( 'pre_get_posts ' , 'osi_query_offset ' , 1 );
379380
380381/**
381382 * Adjust the pagination offset.
382383 *
383384 * @param int $found_posts The number of found posts.
384385 * @param WP_Query $query WordPress Query object.
386+ *
385387 * @return int Adjusted number of found posts.
386388 */
387- add_filter ( 'found_posts ' , 'osi_adjust_offset_pagination ' , 1 , 2 );
388389function osi_adjust_offset_pagination ( $ found_posts , $ query ) {
389390 $ offset = -1 ;
390391 if ( $ query ->is_blog () && is_main_query () && ! is_admin () && ! $ query ->is_front_page () ) {
391392 return $ found_posts - $ offset ;
392393 }
393394 return $ found_posts ;
394395}
396+ add_filter ( 'found_posts ' , 'osi_adjust_offset_pagination ' , 1 , 2 );
0 commit comments