Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » Random post

#1 2006-01-10 12:31:25

kimiko
Member
Registered: 2005-12-01
Posts: 35
Website

Random post

Hello,

is there any way to make a link that opens a random post? Or will I need a plugin for this? I had a similar function in my WordPress powered diary where my visitors could hit the “I’m feeling lucky”-link and read a random entry.

Offline

#2 2006-01-10 14:47:21

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Random post

<txp:article_custom limit="1" sortby="rand()" listform="blah" />

Example listform:
<code>
<txp:permlink>Random article</txp:permlink>
</code>
I think that should work. You could also specify section and/or category in the article_custom tag.

Last edited by doggiez (2006-01-10 14:52:18)

Offline

#3 2006-01-10 16:41:06

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: Random post

@goggiez
Does sortby=rand() work? If so, we should add it to article_custom in Textbook.

Offline

#4 2006-01-10 17:13:08

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Random post

Yes, I’ve been using it for ages to show a random quote on my site. Still working in 4.0.3.

Edit: it’s there on the attributes page.

Last edited by doggiez (2006-01-10 17:15:24)

Offline

#5 2006-01-10 17:17:38

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: Random post

ahh i see.. i was checking txp:article_custom whre it is missing

Offline

#6 2006-01-10 22:08:25

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Random post

This is in the FAQ.


Alex

Offline

  1. Index
  2. » Archives
  3. » Random post

Board footer

Powered by FluxBB