Please tell me how to implement a circular sorting of posts by date


That is, from the top post published today, right 2 days ago, etc. I had an idea - to create four classes or identifiers, in the controller, set conditions depending on the date to change the value of this variable (class name) and pass it to CSS tables in the DIV property. But until it does not work out. Tell me how to properly do what I wanted or tell me another solution