[resolved] menu button >> show posts in random order (4 posts)

  1. gerald@WPcustoms
    Posted 5 years ago #


    I am looking for a solution to sort posts randomly with a menu button.
    what would you suggest is the best way?

    I could think of a PAGE which uses a different template where the query is modified with the 'rand' parameter but this doesn't look like the best way.
    Maby with some code in the functions.php which allows something like this:
    site.com/?orderby=random but I have no idea how to do this.

    thanks for all ideas.

  2. vtxyzzy
    Posted 5 years ago #

    Your idea of a page with a custom template seems like the best way to me.

  3. Mark / t31os

    Posted 5 years ago #

    You should just be able to link to any kind of archive you like, then simply append the URL with ?orderby=rand as orderby is a public query var.. (you can sort simply by querying for it in the URL, eg. example.com/category/example/?orderby=rand).

    Unless you specifically want that functionality to happen on a page, in which case, as said thus far a page template would be the way to go..

  4. gerald@WPcustoms
    Posted 5 years ago #

    "?orderby=rand" is exactly what I was looking for. New to me that this is already built into wp. Thanks a lot for the tip.

Topic Closed

This topic has been closed to new replies.

About this Topic