1414 * Note that this function is hooked into the after_setup_theme hook, which
1515 * runs before the init hook. The init hook is too late for some features, such
1616 * as indicating support for post thumbnails.
17+ *
18+ * @return void
1719 */
1820 function osi_setup () {
1921 /*
@@ -114,6 +116,8 @@ function osi_setup() {
114116
115117/**
116118 * Register sidebars and widgets
119+ *
120+ * @return void
117121 */
118122function osi_widgets_init () {
119123 // Sidebars
@@ -168,7 +172,8 @@ function osi_widgets_init() {
168172 *
169173 * Priority 0 to make it available to lower priority callbacks.
170174 *
171- * @global int $content_width
175+ * @global int $content_width Content width to set.
176+ * @return void
172177 */
173178function osi_content_width () {
174179 $ GLOBALS ['content_width ' ] = apply_filters ( 'osi_content_width ' , 640 );
@@ -177,6 +182,8 @@ function osi_content_width() {
177182
178183/**
179184 * Add a reusable block admin menu link for easy administration.
185+ *
186+ * @return void
180187 */
181188function osi_reusable_blocks_admin_menu (): void {
182189 add_theme_page (
@@ -192,6 +199,8 @@ function osi_reusable_blocks_admin_menu(): void {
192199
193200/**
194201 * Enqueue scripts and styles.
202+ *
203+ * @return void
195204 */
196205function osi_scripts () {
197206 wp_enqueue_style (
@@ -226,7 +235,11 @@ function osi_scripts() {
226235}
227236add_action ( 'wp_enqueue_scripts ' , 'osi_scripts ' );
228237
229- /** Frontend Inline Styles **/
238+ /**
239+ * Add inline styles to the frontend.
240+ *
241+ * @return void
242+ */
230243function osi_inline_styles () {
231244 wp_add_inline_style ( 'osi-style ' , osi_palette_css () );
232245 wp_add_inline_style ( 'osi-style ' , osi_gradient_css () );
@@ -235,7 +248,11 @@ function osi_inline_styles() {
235248}
236249add_action ( 'wp_enqueue_scripts ' , 'osi_inline_styles ' , 100 ); // prioritize as last
237250
238- /** Block Editor Styles **/
251+ /**
252+ * Add block editor assets.
253+ *
254+ * @return void
255+ */
239256function osi_add_block_editor_assets () {
240257 wp_enqueue_style ( 'editor-styles ' , get_template_directory_uri () . '/assets/css/editor-style.css ' , '' , 1 );
241258 wp_add_inline_style ( 'editor-styles ' , osi_palette_css () );
@@ -316,6 +333,8 @@ function osi_add_block_editor_assets() {
316333
317334/**
318335 * Register the "Footer - Above credits" sidebar.
336+ *
337+ * @return void
319338 */
320339function register_footer_above_sidebar () {
321340 register_sidebar (
@@ -333,9 +352,11 @@ function register_footer_above_sidebar() {
333352add_action ( 'widgets_init ' , 'register_footer_above_sidebar ' );
334353
335354/**
336- * Adjust the 'news' (post archive) to show 1 fewer posts on the first page, for symmetry
355+ * Adjust the 'blog' (post archive) to show a different number of posts on the first page.
356+ *
357+ * @param WP_Query $query WordPress Query object.
358+ * @return void
337359 */
338-
339360add_action ( 'pre_get_posts ' , 'osi_query_offset ' , 1 );
340361function osi_query_offset ( &$ query ) {
341362 if ( ! ( $ query ->is_blog () || is_main_query () ) || is_admin () || is_front_page () || is_archive () || is_404 () ) {
@@ -356,6 +377,13 @@ function osi_query_offset( &$query ) {
356377 }
357378}
358379
380+ /**
381+ * Adjust the pagination offset.
382+ *
383+ * @param int $found_posts The number of found posts.
384+ * @param WP_Query $query WordPress Query object.
385+ * @return int Adjusted number of found posts.
386+ */
359387add_filter ( 'found_posts ' , 'osi_adjust_offset_pagination ' , 1 , 2 );
360388function osi_adjust_offset_pagination ( $ found_posts , $ query ) {
361389 $ offset = -1 ;
0 commit comments