We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Restrict number of posts on mobile Reply To: Restrict number of posts on mobile

#6897
Clayton
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.