Here is the problem.
The website in question is http://www.olakalinowska.pl and it is built on wordpress, with the postloop and branding modified to produce the current result. There is a script on the main page which takes all the galleries from a specified album ID and produces a collapsible menu - if you hover on one of the title bars, it will produce a sub-menu with links to specific galleries.
The thing is, the ordering of the galleries seems random. At first I thought it goes by gallery ID, but it does not, if you look at it. I don't think it utilizes any sort of array result ordering.
What I would like it to do is to follow the ordering on the wordpress ngg gallery in the CMS. Any help would be greatly appreciated.
This was suggested to me on a php forums, unfortunately it does not work.<div class="float-me">
<!-- start slub -->
<div id="main-page-slub">
<a class="div-href" href="/slub/">śluby i chrzty</a>
<div class="menu">
<ul>
<li>
<a href="/slub/">śluby i chrzty</a>
<ul id="album-list-slub">
<?php
$aid = 4;
$query = 'SELECT * FROM wp_ngg_album WHERE id = '.$aid.' LIMIT 1'; //album ludzie
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
$sort = $row['sortorder'];
}
$gals_ids = implode(',', (unserialize($sort)));
$query = 'SELECT * FROM wp_ngg_gallery WHERE gid IN ('.$gals_ids.')'; //wszystkie galerie z albumu ludzie
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo ('<li><a href="/slub/?album='.$aid.'&gallery='.$row['gid'].'">'.$row['title'].'</a></li>');
}
?>
</ul>
</li>
</ul>
</div>
</div>
<!-- stop slub -->
<div class="shadow-right"></div>
<div style="clear: both;"></div>
<div class="shadow-bottom"></div>
<div style="clear: both;"></div>
</div>
I've been able to go as far as below, but it only sorts ascending by gallery id and I would have to rework all the gallery id's in the database (I actually lost a record today trying to do this)$query = 'SELECT * FROM wp_ngg_gallery WHERE gid IN ('.$gals_ids.') ORDER BY '.$sort.'';
Hmm, help?$query = 'SELECT * FROM wp_ngg_gallery WHERE gid IN ('.$gals_ids.') ORDER BY gid';