Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-01-28 23:36:32

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,257
Website

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

#2 2020-01-29 07:34:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,760
Website

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.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#3 2020-01-29 07:46:56

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,915
Website

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.

Offline

#4 2020-01-29 07:53:24

etc
Developer
Registered: 2010-11-11
Posts: 3,580
Website

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

#5 2020-01-29 08:02:14

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,915
Website

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.

Offline

#6 2020-01-29 13:21:51

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,257
Website

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

Board footer

Powered by FluxBB