Hi there,
WP has the wp_is_mobile()
template tag:
https://developer.wordpress.org/reference/functions/wp_is_mobile/
Which you can use in your own conditional functions.
For example:
add_action( 'pre_get_posts', function( $query ) {
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
if ( is_home() && wp_is_mobile() ) {
$query->set( 'posts_per_page', 5 );
}
} );
This will change the posts_per_page to 5 on the home page if WP detects its a mobile device.
You can apply this logic with any GP filter such as the generate_hook_element_display
https://docs.generatepress.com/article/generate_hook_element_display/