Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-03-21 20:56:58

kentonq
New Member
Registered: 2014-03-21
Posts: 1

Randomly Display 10 Entries, Not Including Hidden

I’m trying to set up something where I show 10 random entries in a sidebar. This seems like it would be pretty easy, using the sort=“rand()” and limit=“10” attributes.
The problem is that a lot of the entries in this section have a status of “hidden”. This means that sometimes a hidden entry will be called by the sort attribute, and less than 10 entries will be displayed.

Does anyone know if there is a way to call random entries and exclude hidden entries from the search?

Offline

#2 2014-03-21 21:20:05

etc
Developer
Registered: 2010-11-11
Posts: 5,054
Website GitHub

Re: Randomly Display 10 Entries, Not Including Hidden

Hi, welcome to the forum!

kentonq wrote #279884:

The problem is that a lot of the entries in this section have a status of “hidden”. This means that sometimes a hidden entry will be called by the sort attribute, and less than 10 entries will be displayed.

I don’t see why this would happen, given that <txp:article(_custom) /> queries only visible articles. Have you already tried it?

Offline

#3 2014-03-21 22:24:18

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Randomly Display 10 Entries, Not Including Hidden

Hi and welcome to txp.

Old txp versions had the ability to show non live or sticky articles in the front although unless specifically called they never appeared in the list. Just in case you are using an old install you can try: <txp:article_custom limit="10" status="live" break="li" wraptag="ul" sort="rand()"><txp:permlink><txp:title /></txp:permlink></txp:article_custom>


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB