Support » Fixing WordPress » menu button >> show posts in random order

  • Resolved gerald@WPcustoms

    (@geeman12030)


    Hello,

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Your idea of a page with a custom template seems like the best way to me.

    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..

    “?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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘menu button >> show posts in random order’ is closed to new replies.