Keyword

Add an Extra Class to Paginated Posts

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 6 months ago #152129 by Joe Campbell
Add an Extra Class to Paginated Posts was created by Joe Campbell
Is it possible to add an extra class (specifically "lazy") to all listview items on page 1 ONLY?

So that the first page list items contains the classes "catItemImage lazy"

while listview items on all paginated pages (page 2,3,4...) only contain "catItemImage"

Of course I would like this to be implemented on both category and tag pages :)

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #152151 by Javi Mata
Replied by Javi Mata on topic Add an Extra Class to Paginated Posts
if you add in the top of you template code some like:
$actualPage = $this->pagination->pagesCurrent;

you get the actual page, so, with this, you can use some like

<div id="k2Container" class="<?php if($actualPage==1) ?>lazy<?php endif;?>">

Twitter: @Javi_Mata
Web: www.javimata.com

Please Log in or Create an account to join the conversation.

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 6 months ago #152152 by Joe Campbell
Replied by Joe Campbell on topic Add an Extra Class to Paginated Posts
Thanks @JaviMata

It works, I just needed to add the colon (see below)

<?php if($actualPage==1): ?>lazy <?php endif; ?>

For anyone else interested in this solution, make sure to implement the code on the category_item.php override file :)

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 6 months ago #152162 by Krikor Boghossian
Replied by Krikor Boghossian on topic Add an Extra Class to Paginated Posts
;)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum