Ciao guys,
I'm getting mad with this issue. I have a script in a WP theme that it's supposed to retrieve some data. It works ok but I need it does the thing in alphabetic mode and this seem to be... quite hard!
I dig into the web looking for plugin with no success and even modifing the core like they say here http://codex.wordpress.org/Alphabetizing_Posts
I need help because I'm stucked. The url where this happen is this: http://www.jre.it/?s=&geo-radius=50&geo-lat=&geo-lng=&categories=0&locations=0&dir-search=yes&post_type=ait-dir-item
If yiu try to press ENTER just in the forst field (Ristorante, Chef, Città ) the order is not in alphabetic mode because the first result is "Trippini".
Here what I have in category.php on themes folder:
{extends $layout}
{block content}
{if $posts}
<article id="post-{$post->id}" class="{$post->htmlClasses}">
<header class="entry-header">
<h1 class="entry-title">
<span>{$category->title}</span>
</h1>
</header>
{if strlen($category->description) !== 0}
<div class="entry-content">
{!$category->description}
</div>
{/if}
</article><!-- /#post-{$post->id} -->
{include snippets/content-nav.php location => 'nav-above'}
{include snippets/content-loop.php posts => $posts}
{include snippets/content-nav.php location => 'nav-below'}
{ifset $themeOptions->advertising->showBox4}
<div id="advertising-box-4" class="advertising-box">
{!$themeOptions->advertising->box4Content}
</div>
{/ifset}
{else}
{include snippets/nothing-found.php}
{/if}
{/block}
And this is the code of content-loop-dir-search.php that seem to be the result page:
{foreach $posts as $item}
{first}<ul class="items">{/first}
<li class="item clear{ifset $item->packageClass} {$item->packageClass}{/ifset}">
{if $item->thumbnailDir}
<div class="thumbnail">
<a href="{!$item->link}"><img src="{timthumb src => $item->thumbnailDir, w => 100, h => 100}" alt="{__ 'Item thumbnail'}"></a>
</div>
{/if}
<div class="description">
<h3>
<a href="{!$item->link}">Ristorante {$item->post_title}</a>
</h3>
<?php
//var_dump($options);
global $wpdb;
$sql = "SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE post_id=".$item->ID." AND meta_key LIKE '%_ait%'";
$itemMeta = $wpdb->get_results($sql);
$itemMetaValue = unserialize($itemMeta[0]->meta_value);
//var_dump($itemMetaValue);
echo
"Chef: ".$itemMetaValue['nome-chef']." ".$itemMetaValue['cognome-chef']."<br/>"
.$itemMetaValue['address']."<br/>"
.$itemMetaValue['cap']." ".$itemMetaValue['citta']." (".$itemMetaValue['provincia'].")<br/>"
."T: ".$itemMetaValue['telephone']."<br/>";
?>
</div>
<hr class="bg" />
</li>
{last}</ul>{/last}
{/foreach}
Thanks everybody for your help.
CM