Number of posts per page

  • Unknown's avatar

    Hi everyone. I was wondering if it’s possible to set via CSS the number of posts that shows in a specific page. For instance, I’d like the .archive.date to display 10 posts and .category-47502 only 8.

    Does anyone know how to do that?

    Thanks!

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi, usinarevista

    Hopefully someone else will have a clever solution, but this isn’t really a job for CSS.

    You might look into trying to work something up using an :nth-child recipe. For example, if you had a page with 10 category-47502 posts, you might try:

    .category-47502:nth-child(n+8) {display: none;}

    This will target all occurrences of this element, except the first 8 inside of a parent. Here’s a quick CodePen demo – http://codepen.io/smutek/pen/zmLCn

    Note that this particular approach isn’t going to work unless the items occur by themselves inside of a containing element.

    Again, this is a job for configuration and templates, not so much CSS.

    I hope this helps somewhat.

  • Unknown's avatar

    It’s really disappointing that CSS can’t manage to easily do that :(

    Thanks anyway jsmutek! It works in the .category pages, but for some reason the .home/latests-posts don’t accept it…

  • Unknown's avatar

    Not a problem, usinarevista, and sorry it didn’t help.

    Like I mentioned, that’s really not a job for CSS. CSS is meant for presentation.

    Posts per page is a structural change that should be handled with PHP and HTML, in the templates, and WordPress.com does not allow that level of access for security reasons.

    All the best!

  • The topic ‘Number of posts per page’ is closed to new replies.