• Resolved thomaspayne

    (@thomaspayne)


    is it possible to sort pages in a random order?

    using the AutoNav plugin and trying to display all the page thumbnails in a random order.

    anybody know if this is possible?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Try using version 1.3.0 with the parameter: order=”rand”

    Thread Starter thomaspayne

    (@thomaspayne)

    hey wlindley, thanks for getting back to me.

    tried your recommendation but with no joy.

    wondered if you had any more thoughts? would be super useful if there was a way to display in random.

    The order="rand" parameter currently randomizes attachments and posts but not child pages… you want the child pages in random order? That seems odd to me… not impossible, but wouldn’t that make the site difficult to navigate?

    Thread Starter thomaspayne

    (@thomaspayne)

    yeah its to display projects, so that no work is favoured by any sort of order. seemed like the most egalitarian way of presenting the child pages.

    also think it would give a really dynamic feel if the child pages could rearrange their order on each refresh, so the parent page would always look different.

    i’d be incredibly grateful if you or anyone else could provide any sort of advice or assistance on randomising the order!

    It’s really easy.

    In the plugin code, look for the function

    function get_subpages ($attr)

    Then near the end of the function add this:

    // Existing code ...
    if (count($pages) == 0) {
        return;
      }
    // Add this
      if ($attr['order']=='rand')
      {
    	shuffle($pages);
      }
    // Rest of existing code
      return get_pics_info($attr, $pages);

    Did the trick for me (for exactly the same application ??

    Thread Starter thomaspayne

    (@thomaspayne)

    doesn’t seem to be working for me. is there anything else i need to set as well?

    Thread Starter thomaspayne

    (@thomaspayne)

    https://thomasjwpayne.com/dbuckingham/

    …is the site im working on. the order might seem random at first but i’ve got the parameter set to menu_order which is why ‘test 3’ is top of the list.

    thomaspayne asked me:

    doesn’t seem to be working for me. is there anything else i need to set as well?

    Well, not that I know of. I use the following shortcode in the page:

    [autonav display="images" pics_only="1" order="rand"]

    This page changes the order each time it loads. Other pages (without the order parameter) show the pages in the defined fixed order.
    This works for me, can’t show it (yet) because the site is not open to the public (yet).

    Thread Starter thomaspayne

    (@thomaspayne)

    brilliant! got it working! many thanks.

    Thread Starter thomaspayne

    (@thomaspayne)

    however, does seem to be occasionally missing off one of the child pages when i load the page. any thoughts?

    No idea, I currently have 9 child pages and all of them are loading fine.

    Thanks, thomas_n. Added that patch to v1.3.1.

    I’m using [autonav display=”images” count=”3″ order=”rand”] as a “Random products” gallery for my online shop. The more I try things out, the more I realise how useful your plugin is.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[AutoNav] using sort_column parameter to display random order’ is closed to new replies.