Random Sticky
| Version | Released | Type | License |
|---|---|---|---|
| 1.0 | 2007-09-19 | Plugins | Freeware (?) |
On a website I needed a kind of “featured article of the day” to sit on top of all other articles. This article was to be pulled randomly from all entries of a particular weblog and was supposed to automatically change every 24 hours.
My first approach was to simply use:
{exp:weblog:entries limit="1" orderby="random" cache="yes" refresh="1440"}
While this was working in principle there were two drawbacks:
- I’m clearing all caches when new entries are posted.
- Using two weblog:entries-tags - one for the random and one for the rest - leaves me with the possibilty of one article appearing twice unless I use some extra code to exclude the randomly selected entry from the second list.
So my second approach was writing a small plugin that randomly reassigns the ‘sticky’-flag(s) in a given weblog in fixed intervals.
