Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-02-11 11:11:11

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Link to (not) next, or reorder articles

Is there a way of reordering Articles? I’m building a quite large portfolio which will be added to as and when, but I don’t always want articles ordered in the order I write them. In particular, with my needs I’m seeing inherent trouble with txp:link_to_next, txp:next_title etc., which I want to use to link / title a link linking to the next (or previous) article as I want them ordered. Gah. Ta!

Offline

#2 2021-02-11 11:36:56

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,246
Website GitHub

Re: Link to (not) next, or reorder articles

By default, articles are ordered by date – most recent first – if you use a bare <txp:article /> tag. So to adjust the order when using it like this, you need to tweak the Date/Time of the articles. This has to be done on a per-article basis (unless you want to mess about changing them en-masse in the database directly).

To view them in a different order you can alter the sort attribute or change the way they’re filtered first, via <article_custom> (e.g filtering by category or something).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2021-02-11 11:49:27

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Re: Link to (not) next, or reorder articles

So, the sort-of-cheat way is to change the post date; that works, though I can see it being a bit of a pickle when I start slotting in new work down the road.

Would stm_article_order be worth considering and do the job? That’s a very long string about it!

Offline

#4 2021-02-11 12:04:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,246
Website GitHub

Re: Link to (not) next, or reorder articles

nobi-wan wrote #328745:

So, the sort-of-cheat way is to change the post date; that works, though I can see it being a bit of a pickle when I start slotting in new work down the road.

Yeah, it’s a faff if you want to insert stuff. I’ve got round that on corporate sites by leaving suitable gaps (days/weeks) between articles so there’s plenty of space to slot stuff in later. And use older posting dates (like years ago) since the dates aren’t actually publicised on the site.

I agree it’s not ideal so yes some ordering plugin like stm_article_order (if it still works!) would be the more visual route.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2021-02-11 12:15:53

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Re: Link to (not) next, or reorder articles

That plugin’s link seems dead. Seems like that functionality as an optional standard would be handy to a fair few people… though I could be just imagining that. But then again, you had to faff with it yourself…

Anyway. Thanks Bloke!

Offline

#6 2021-02-11 12:28:23

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,129
Website

Re: Link to (not) next, or reorder articles

nobi-wan wrote #328747:

That plugin’s link seems dead.

Actually, I believe stm_article_order does still work (or at least just needs a few display tweaks). At least, I’ve seen in it working on updated sites. There’s a link to an updated version in the thread.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2021-02-11 16:06:35

etc
Developer
Registered: 2010-11-11
Posts: 4,252
Website GitHub

Re: Link to (not) next, or reorder articles

Is not sorting by id="13,2,..." or by some custom field an option?

Offline

#8 2021-02-12 10:52:28

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,129
Website

Re: Link to (not) next, or reorder articles

etc wrote #328779:

Is not sorting by id="13,2,..." or by some custom field an option?

Yes, both methods work too. Like bloke mentioned, with a custom field it’s prudent to leave gaps in the numbering in case you need to place something in between at a later date and don’t want to renumber numerous articles.

jakob wrote #328749:

Actually, I believe stm_article_order does still work…

For what it’s worth, I tried it out yesterday on the upcoming txp 4.8.5 and PHP8 and there was one small niggle (which may not even occur with PHP 7) that I was able to clear up. I’ll try and update the plugin and pass it back to Uli’s GitHub account at the weekend.


TXP Builders – finely-crafted code, design and txp

Offline

#9 2021-02-25 18:01:17

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Re: Link to (not) next, or reorder articles

Thanks! I got the plugin installed and it appears to be working… :)

Offline

#10 2021-02-25 20:45:56

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,129
Website

Re: Link to (not) next, or reorder articles

Glad that helped. If you come across something, do post in that thread. I can’t profess to knowing the plugin very well, but there are others there who have also helped keep it in working order.


TXP Builders – finely-crafted code, design and txp

Offline

#11 2021-03-17 18:28:49

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Re: Link to (not) next, or reorder articles

So, I think it was working before I upgraded to 4.8.4. Now, well… not sure what’s happening.
next_title and prev_title aren’t showing the right thing, though link_to_next etc seem okay; can’t actually work out where those titles were coming from as it wasn’t chronological. (Admittedly, I didn’t try too hard to find out — it’s been an arduous day.) I’ve disabled it, for now…

Offline

#12 2021-03-17 19:16:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,246
Website GitHub

Re: Link to (not) next, or reorder articles

Do the link to next docs shed any light on it? In older versions, next/prev_title had to be used inside link_to_next/prev, but that changed in more recent versions so you need to use the bare title tag instead. That doc explains more. I suspect this is what is happening here.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB