Home › Forums › Pro Support › Restrict number of posts on mobile › Reply To: Restrict number of posts on mobile
December 17, 2018 at 8:05 am
#6897
Participant
Kind of a work around but you can use nth child CSS selectors.
.home-posts article:nth-last-of-type(-n+2) {
display: none !important;
}
Wrap the shortcode in a div and give it the class of your choice. The CSS above with will hide the last two elements (posts) within that div. Then just use CSS3 media query to apply this css based on screen width. This is a great media query generator: http://giona.net/tools/css3-mediaquery-generator/
I’m using this to change the number of posts being displayed on mobile and it works like a charm other than they are just hidden with display: none;
via CSS.