WordPress.org

Support

Support » Plugins and Hacks » Incorrect result using sorting posts by title with WP Query and the Loop

Incorrect result using sorting posts by title with WP Query and the Loop

  • InvinciP
    Member

    @herophuong

    Hello! I post this problem here and hope someone can help me sort out it. I created a custom template to list all my posts. I used $wp_query to pass option to the custom Loop like this:

    <?php
        $temp = $wp_query;
        $wp_query= null;
        $wp_query = new WP_Query();
        $wp_query->query('posts_per_page=40'.'&paged='.$paged.'&category_name=truyen-dai'.'&orderby=title'.'&order=ASC');
    ?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
        <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
    <?php endwhile; ?>

    It works but there a problem with Vietnamse language. It places the posts starting with letter “Đ” at the end of the list, while in Vietnamese, “Đ” is right after “D”.
    If someone know how to fix this plz help me, or if you know whether there are any other methods which fully support sorting unicode characters plz let me know.
    Thks in advance.

  • The topic ‘Incorrect result using sorting posts by title with WP Query and the Loop’ is closed to new replies.