Jump to content

Recommended Posts

Posted

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!

Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...