-
AuthorPosts
-
June 9, 2020 at 3:53 pm #1220895
Hi guys,
couldn’t find a solution to this …Is there a way of showing / displaying images in a numerical order? … as in:
Filename: xyz
Description: 1Then that image would display before 2, 3, 4 and so on.
June 9, 2020 at 8:50 pm #1220967Hey joefraser,
Are you using masonry gallery?
Best regards,
Jordan ShannonJune 9, 2020 at 9:20 pm #1220975Hi Jordan – yes, I am currently using the Masonry Gallery so it would be handy to find a fix for that in particular.
June 9, 2020 at 10:35 pm #1220987Hi,
Edit Masonry Gallery and click on Add/Edit Gallery button then drag and drop images in the order that you want.
Best regards,
Jordan ShannonJune 9, 2020 at 11:53 pm #1221021I appreciate that – but the client wanted to add images and label them and have the site order automatically, irrespective of their position in the gallery back-end (so to speak).
Probably needs coding separately.
June 10, 2020 at 1:36 am #1221028you can try that filter – put this to your child-theme functions.php
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);
i do not know how it is reacting on “load more” Galleries.
June 10, 2020 at 2:34 am #1221031by the way – dear mods: how can i use this only for a specific page ?
June 10, 2020 at 12:40 pm #1221168Wonderful – thank you very much; this worked.
Aye, not sure how load more might work but this opens the door etc,
June 10, 2020 at 2:49 pm #1221216it works ! i tested it afterwards
But indeed i like to know how the syntax might be if i only want to have it on a given page.
June 10, 2020 at 4:33 pm #1221258I think a mod. could solve that – it’s likely possible with a $query / page ID combo …
June 10, 2020 at 8:31 pm #1221392Guenni007 … you wouldn’t happen to know how to sort by ‘excerpt’ rather than ‘title’ … so it’s this code I assume, just more excerpty ;)
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);June 11, 2020 at 4:03 am #1221493But you are talking about an image gallery?
Or have you an masonry_entries ( a blog or portfolio etc )June 11, 2020 at 4:08 pm #1221745The code worked perfectly to numerically order ‘Masonry Gallery’ images … but by the ‘title’ information.
Typically, the client wanted to sort by the ‘excerpt’ information. Each Masonry Gallery image can have a title and a caption/excerpt.
June 11, 2020 at 4:22 pm #1221753these are parameters to wp_query: https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters
so i guess no direct chance to have it hereJune 11, 2020 at 4:38 pm #1221767Thanks for that Guenni007 … no joy … I’m going to attempt another thread to collar a mod response …
June 12, 2020 at 6:55 pm #1222151Hi joefraser,
According to the docs, there is no such option to sort by the image caption. So we cannot really provide you such an option.
If you need further assistance please let us know.
Best regards,
VictoriaJune 13, 2020 at 5:34 pm #1222384OK Victoria – thank you anyway.
June 15, 2020 at 9:05 am #1222568if you realy need this i do only see for now a plugin solution. There are a lot of good – especially for fotographers – that have this option on sorting by caption.
See Envira or NextGen GalleryJune 15, 2020 at 4:20 pm #1222714Hi Guenni007,
Thank you for your suggestion :)
@joefraser You might want to consider using one of the plugins suggested by Guenni007.Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.