[wp-hackers] How to display random post with next and previous links alphetically showed

Otto otto at ottodestruct.com
Tue Jul 12 14:09:38 UTC 2011


I haven't tried it, but from a quick glance at the query code, this might work:

query_posts(array('orderby'=>'rand title'));

There's a single space between rand and title. So you'll get random
posts which should then be ordered by the title.

-Otto



On Tue, Jul 12, 2011 at 7:57 AM, Deepak Mittal <dpac.mittal2 at gmail.com> wrote:
> Hi guys,
>
> I am trying to display a random post on homepage using
>  query_posts('orderby=rand')
>
> The problem is I want to display the next and previos post links
> alphabetically. That is to say, if I have posts with following titles:
>
> Apple
> Ball
> Cat
> Dog
>
> And if Cat is chosen as random post, the next and previous link should show
> Dog and Ball respectively. Any help for achieving this would be highly
> appreciated.
>
> --
> Regards,
> Deepak Mittal,
> Twitter - @dpacmittal
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list