BuddyDev

Search

[Resolved] Sort Single Document Gallery

  • Participant
    Level: Initiated
    Posts: 6
    Fah Q on #18429

    How can I sort a document gallery’s documents by alphabetical order?

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #18434

    Hi Fah,
    You can use the code you posted in
    https://buddydev.com/support/forums/topic/how-to-sort-sitewide-gallery-2/

    That will do it.

    Also, since you did not reply there, I will be marking that as resolved(It will be open for reply for next few days).

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    Fah Q on #18461

    Unfortunately, that code didn’t work.

    I am relying on the manual re-ordering at the moment, but would still like to know if can sort the documents alphabetically by default

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #18462

    Hi Fah,
    I am sorry to hear that.
    Did you apply the order parameter to “ASC” as by default it is not set to ASC? If yes, Please let me know and I will look into it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    Fah Q on #18465
    function buddydev_modify_media_order( $args ) {
    
    $args['order'] = 'ASC';
    
    return $args;
    }
    add_filter( 'mpp_main_media_query_args', 'buddydev_modify_media_order' );

    Changing ASC to DESC doesn’t seem to change the order

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #18466

    Instead of

    
    $args['order'] = 'ASC';
    

    Please use both.

    
    $args['orderby'] = 'title';
    $args['order'] = 'ASC';
    
    

    Does that work?

  • Participant
    Level: Initiated
    Posts: 6
    Fah Q on #18478

    Yes this seems to have worked.

    However, if you manually rearrange items, that code is ignored. I suppose that is how it should work.

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #18483

    Thank you for confirming.

    Yes, That is expected behaviour. User’s reordering manually overwrites the default.

    I also believe it is the correct way to avoid user confusion.

    Marking resolved.

    Regards
    Brajesh

The topic ‘ [Resolved] Sort Single Document Gallery’ is closed to new replies.

This topic is: resolved