i'm sorting posts alphabetically with first letter above posts and works fine, but i need to display some slavic characters like ć,č,ž,đ...(UTF-8).
This is the code:
<?php
$args = array(
'orderby' => 'title',
'order' => 'ASC',
'caller_get_posts' => 1,
'posts_per_page' => -1,
);
query_posts($args);
if (have_posts()) {
$curr_letter = '';
while (have_posts()) {
the_post();
$this_letter = strtoupper(substr($post->post_title,0,1));
if ($this_letter != $curr_letter) {
echo "<span>$this_letter</span>";
$curr_letter = $this_letter;
}
?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<?php }
}
?>
I tried with this:
$this_letter = mb_strtoupper(mb_substr(apply_filters('the_title',$post->post_title),0,1));
$this_letter = mb_convert_encoding($letter,'UTF-8', mb_detect_encoding($this_letter) );
instead of this:
$this_letter = strtoupper(substr($post->post_title,0,1));
but doesn't work.
I appreciate your help.