php - WordPress Sorting by characts - Swedish characters -
my website in swedish , write different kind of topics. in sweden have these kind of characters ö, ä & å. have created page show cpt posts start character a. problem getting that
when showing posts start Ä shows posts starting & Å. same thing if example want show posts starting o shows posts starting Ö also.
how go filter out right.
here code
<?php //get post ids posts start letter a, in title order, //display posts global $wpdb; $char_a = 'a'; $postids = $wpdb->get_col($wpdb->prepare(" select id $wpdb->posts substr($wpdb->posts.post_title,1,1) = %s order $wpdb->posts.post_title",$char_a)); if ($postids) { $args=array( 'post__in' => $postids, 'post_type' => 'encyklopedi', 'post_status' => 'publish', 'posts_per_page' => -1, // 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new wp_query($args); if( $my_query->have_posts() ) { // echo 'list of posts titles beginning letter '. $char_a; while ($my_query->have_posts()) : $my_query->the_post(); ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php endwhile; } else { ?> <p><?php _e( 'kunde inte hitta några inlägg som börjar med a...' ); ?></p> <?php } wp_reset_query(); } ?>
is maybe should in $char_a = 'here'; or maybe in functions ?
Comments
Post a Comment