Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #4431

    I would love to have the portfolio items displayed in random order as this would drastically improve my project.

    Although I am quite sure that this is very easy to achieve I haven’t figured it out yet.

    Do you have any hints for me?

    #46292

    Hey,

    open up includes/loop-portfolio.php and replace:

    if(isset($avia_config['new_query'])) { query_posts($avia_config['new_query']); }

    with:

    if(isset($avia_config['new_query'])) {
    $avia_config['new_query']['orderby'] = "rand";
    query_posts($avia_config['new_query']);
    }

    #46293

    Cool stuff! You made my day! :)

    That works exactly as expected, Thanks a lot.

    I am now in a position to allow the user to sort the portfolio list on her own (by date of entry, by name, random, etc.)

    Cheers

    Manidini

    #46294

    Glad that I could help you :)

    #46295

    Unfortunately this solution does only work with a small number of portfolio items.

    If Portfolio Pagination kicks in (because there are more portfolio items than the specified Portfolio Post Number) it seems to me as if a new result set is fetched from the database.

    So on page 1 I have portfolio items in random order (as expected). On page 2 I have a new set of portfolio items in random order.

    What happens: I see some portfolio items twice (on both pages) and others I see never! :(

    #46296

    Hey,

    Unfortunately this is one of the “problems” with using a random order. For paged pages (i.e. second / third / fourth etc) you would need to write some custom code to exclude all the portfolio entries from the 1st page and then display a random selection of items that remain. This would then need repeating to exclude entries from the 1st and 2nd pages for the 3rd etc.

    The alternative is to remove the pagination by changing the number of entries displayed on a page to exceed the number of entries that exist; this would ensure all entries are displayed on the same page in a random order.

    James

    #46297

    James, thanks for getting back to me.

    Your first suggestion is not really feasible as on later pages it might get difficult to find new portfolio items which haven’t been displayed yet (if any!).

    Your alternative will only work with a limited number of portfolio entries as otherwise the loading process of all those featured images will take too much time.

    I will let the user choose which display order he/she prefers.

    A random order does not really make sense for the end user, but is a requirement from my portfolio partners who want to be on top of the list from time to time no matter where they are placed in an alphabetical order.

    Anyway, this topic can be closed.

    #46298

    Closed :)

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Portfolio Items In Random Order?’ is closed to new replies.