Site logo

Archived topic

How to change the bg-colours for buttons on archive-pages dynamically?

1 reply · Started by Sascha on October 31, 2022

Viewing posts 1–2 of 2

Hello,

on this archive-page, I'd like the "Read more" buttons (here: "Weiterlesen" buttons) to have different bg-colours:

Button of latest post: green-bg
Button of latest but 1 post: yellow-bg
Button of latest but 2 post: black-bg
and restarting with green again.

Is this something I can achieve with GP/GP-Elements?

Thank you in advance and kind regards,
Sascha

Try this:

:is(.blog,.archive) article.post:nth-of-type(3n) .read-more-container a {
    background: black;
}

:is(.blog,.archive) article.post:nth-of-type(3n-1) .read-more-container a {
    background: yellow;
}

:is(.blog,.archive) article.post:nth-of-type(3n-2) .read-more-container a {
    background: green;
}
This archived topic is closed to new replies.