Answer the question
In order to leave comments, you need to log in
How to change posts_per_page depending on the screen resolution, on 3 resolutions: mobile, 768-992 -tablet, monitors from 992 and above?
How to change posts_per_page depending on the screen resolution, on 3 resolutions: mobile, 768-992 -tablet, monitors from 992 and above? I have such posts, there are 4 of them on the page
<?php $query = new WP_Query( array( 'posts_per_page' => 8, 'cat'=> 6 ));?>
<?php if( $query->have_posts() ){
while( $query->have_posts() ){
$query->the_post(); ?>
<?php if(get_the_...
<?php the_time( 'dmY'); ?>
<?php the_title(); ?>
<?php }
wp_reset_postdata();
} ?>
Answer the question
In order to leave comments, you need to log in
No way, the screen width is not transmitted in the request headers, you can replace the generation of the list of posts on the backend with an ajax request that will be executed after the page is loaded
Option to request the maximum number of posts, and then hide unnecessary CSS at a certain resolution
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question