Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Apply a class to last entry in activity feed

  • Avatar of Henry
    Henry
    Member

    @thirstcard

    How could you determine if an entry is the last item in the activity feed? I need to apply the class “last” to it so I can make the entry stand out using CSS.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Use CSS??!! :) psuedo class :last-child

    Avatar of Henry
    Henry
    Member

    @thirstcard

    Ah yes, of course! Thanks again Hugo!

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    you could do things the hard way, using PHP which has no real ‘method’ to get the last item in an array or loop, instead you have to cobble bits together depending on the type of array and it’s a lot more painful.

    Avatar of Henry
    Henry
    Member

    @thirstcard

    I did come up with something to apply a class to every third item in a loop by incrementing a variable on each pass. This was quite straight forward using PHP. Identifying the last item in a loop with PHP isn’t as easy. Your CSS solution was a great shout.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.