Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Add class to newer/older
I am working on adapting a template I purchased to work with Textpattern.
In the template, the active line of pagination looks like:
<li class="active"><a href="#">3</a> </li>
I’ve been trying to emulate the behavior by copying/stealing code from Pat64’s wonderful example
<txp:newer shift="0" break="li" class="active"><txp:yield item="page" /></txp:newer>
Unfortunately, class is not a supported attribute of newer.
<li><a href="https://patetech.info/?pg=4">4</a></li>
Offline
Re: Add class to newer/older
Hi Michael
Although I agree that a class attribute would be great, I’m wondering if this would work for you:
<li class="active"><txp:newer shift="0" link="" break=""><txp:yield item="page" /></txp:newer></li>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Add class to newer/older
I am kinda surprised – but I may have something – but I thought the class
attribute was a global one, and thus would apply. It sure would be useful as your case illustrates.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Add class to newer/older
phiw13 wrote #321410:
I am kinda surprised – but I may have something – but I thought the
class
attribute was a global one, and thus would apply. It sure would be useful as your case illustrates.
It is global, but applies to wraptag
. Otherwise, what would be its action on unwrapped tags like <txp:site_name class="home" />
?
Yiannis suggestion is the simplest one, but you can also try
<txp:newer shift="0" wraptag="li" class="active"><txp:yield item="page" /></txp:newer>
<txp:newer shift="0" break="li" breakclass="active"><txp:yield item="page" /></txp:newer>
Offline
Re: Add class to newer/older
etc wrote #321411:
It is global, but applies to
wraptag
.
yes, it is as I just discovered after adding my comment above.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Add class to newer/older
colak wrote #321409:
Hi Michael
Although I agree that a class attribute would be great, I’m wondering if this would work for you:
<li class="active"><txp:newer shift="0" link="" break=""><txp:yield item="page" /></txp:newer></li>...
It did indeed. Thanks. I tried a few variations but couldn’t quite get the syntax down.
Offline