-
AuthorPosts
-
August 7, 2014 at 3:46 pm #301160
Hi is there any way to sort the masonry galleries by image title?
Thanks.August 7, 2014 at 4:10 pm #301164Hi mazerti!
Best regards,
YigitAugust 7, 2014 at 7:50 pm #301290Hi, thanks for the link but the instructions don’t seem to be working.
I’ve added it to the child themes function.php saved it, gone to the page with the masonry gallery, and there’s no extra sort option when editing it. I’ve tried refreshing the page and restarting the browser but still no luck. :(August 8, 2014 at 5:31 am #301452Hi!
I’m sorry but the sort order is for the Masonry element only. You need to manually sort the masonry gallery images.
Regards,
IsmaelAugust 8, 2014 at 11:58 am #301564Surely there must be some code I could edit to arrange them? I guess I would have to change ASC to TITLE somewhere?
Would take me ages to alphabetically arrange over a hundred images manually.August 8, 2014 at 6:05 pm #301759Hey!
Try to insert this code into the theme functions.php file:
if(!function_exists('avia_change_posts_query')) { function avia_change_posts_query($query, $params) { if(!empty($query['orderby']) && $query['orderby'] == 'post__in') { $query['order'] = 'ASC'; $query['orderby'] = 'title'; } return $query; } add_filter('avia_masonry_entries_query', 'avia_change_posts_query', 10, 2); }
Cheers!
PeterAugust 11, 2014 at 1:33 pm #302580Hi Peter,
Added the code to the child theme but got this error: Parse error: syntax error, unexpected ‘{‘, expecting T_STRING or T_VARIABLE or ‘$’ in /home/ufitkitc/public_html/wp-content/themes/enfold-child/functions.php on line 3
Don’t know much about php coding so can’t spot the error myself.
Cheers.August 12, 2014 at 3:41 pm #303260Hi!
Please try copy&pasting the code Peter posted from here directly – http://pastebin.com/jbUd7dKQ
It does work fine on my local installationRegards,
YigitAugust 12, 2014 at 6:18 pm #303371Thanks,
Tried the code from pastebin and it worked perfectly, also tried peters code again and that worked so I must of copied it wrong :(
Cheers. -
AuthorPosts
- The topic ‘Sort masonry gallery by title’ is closed to new replies.