jploch Posted September 27, 2015 Posted September 27, 2015 Hello! I have a problem with the order my images display on a gallery iam building for my new homepage. My gallery displays an image for every page that has the parent "work" and the field thumbnail. It works, but the images seemes to be sorted by the time the page was createted. I want the order of the images to be the order of the pages (I want to use the "move" button in pw to rearrange them). Here is my code: <?php $projects = $pages->find("parent=/work/"); foreach($projects as $project) { $out .="<a href='{$project->url}' class='item {$project->thumbnail->tags}'>"; if($project->thumbnail){ $out .="<img src='{$project->thumbnail->url}'>"; } $out .="<div class='item-info'><h1>{$project->title}</h1><p>{$project->thumbnail->description}</p></div>"; $out .="</a>"; } echo $out; ?> Thanks!
kongondo Posted September 27, 2015 Posted September 27, 2015 Have you tried sort=sort in your find? $projects = $pages->find("parent=/work/, sort=sort");
jploch Posted September 27, 2015 Author Posted September 27, 2015 Have you tried sort=sort in your find? $projects = $pages->find("parent=/work/, sort=sort"); Thanks kongondo for the super fast reply! That was exactly what I was looking for. Problem solved!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now