diff --git a/wp-content/themes/mozilla-ai-intersections/archive-ai_intersections.php b/wp-content/themes/mozilla-ai-intersections/archive-ai_intersections.php index 92bd033..c012b4d 100644 --- a/wp-content/themes/mozilla-ai-intersections/archive-ai_intersections.php +++ b/wp-content/themes/mozilla-ai-intersections/archive-ai_intersections.php @@ -21,7 +21,7 @@
- > + >
@@ -402,7 +402,7 @@ $args = array( 'post_type' => 'ai_intersections', - 'posts_per_page' => isset( $_GET['records'] ) ? $_GET['records'] : 8, + 'posts_per_page' => isset( $_GET['records'] ) ? intval($_GET['records']) : 8, 'orderby' => 'date', 'order' => 'DESC', 'tax_query' => $tax_query, @@ -410,7 +410,8 @@ ); if ( isset( $_GET['sort'] ) ): - switch ( $_GET['sort'] ): + $sort = sanitize_text_field($_GET['sort']); + switch ( $sort ): case 'recent': $args['orderby'] = 'date'; $args['order'] = 'DESC'; @@ -433,11 +434,11 @@ $records = new WP_Query( $args ); $records_count; - $records_current = ( $_GET['records'] ) ? $_GET['records'] : 8; + $records_current = ( $_GET['records'] ) ? intval($_GET['records']) : 8; $records_total = $records->found_posts; if ( isset( $_GET['records'] ) ): - $records_count = ( $_GET['records'] > $records_total ) ? $records_total : $_GET['records']; + $records_count = ( intval($_GET['records']) > $records_total ) ? $records_total : intval($_GET['records']); else: $records_count = ( $records_total < 8 ) ? $records_total : 8; endif;