Skip Navigation

[Gelöst] Hi! I have an issue with alphabetical order using É

This support ticket is created vor 3 Jahre, 11 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 Antworten, has 2 Stimmen.

Last updated by Luo Yang vor 3 Jahre, 11 Monate.

Assisted by: Luo Yang.

Author
Artikel
#1611031

Anonym
Screen Shot 2020-05-04 at 11.30.18 AM.png

Hi! I have an issue with alphabetical order using É

Instead of being used as a «E» it is placed at the end. See image for support; using «E» and using «É». The website is in french so, I must use «É». I'm wondering how to get it fix througt all website. 🙂
THANK YOU!

#1611763
order-by.JPG

Hello,

I assume we are talking about a post view, and order by post title, I have tried it in my localhost, it works fine, see screen order-by.JPG, please edit your post view, make sure you are using option: Order by post title Ascending.

In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, and test again

#1612343

Anonym

Hi, thank you for your response. I appreciate. Those are taxonomy title, or group of posts. They are ordered on a list page or a detailed page like this "[wpv-post-taxonomy type="lieu" separator="  |  " order="asc"]".
Thank you, and have a great day.

#1613265

Thanks for the details, see our document:
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-post-taxonomy
There isn't such kind of built-in feature within shortcode [wpv-post-taxonomy] to sort the result using a "natural order" algorithm.

You can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Currently, you can setup a custom shortcode to replace it, for example:
1) Add below PHP codes into your theme file functions.php:

add_shortcode('my-post-taxonomy', function($atts, $content){
	$atts = shortcode_atts( array(
		'type' => 'lieu',
		'separator'	=> '  |  ',
		'order'	=> 'asc',
	), $atts);
	
	$res = do_shortcode( sprintf('[wpv-post-taxonomy type="%s" separator="%s" order="%s"]', $atts['type'], $atts['separator'], $atts['order']));
	$arr = explode($atts['separator'], $res);
	if($arr){
		natsort ( $arr );
		if ( $atts['order'] == 'desc' ) {
			$arr = array_reverse ( $out_terms );
		}
		$res = implode( $atts['separator'], $arr );
	}
	return $res;
});

2) Use above shortcode, like this:

 [my-post-taxonomy type="category" separator="  |  " order="asc"]

More help:
hidden link

#1619999

Anonym

HI, Thank you very much for your help and your example. But... this short code would be used for many «type» and two types of separators. How would I change the function to be more flexible? I'm not confident with my programmation skills. Thank you again !

#1620599

You don't need to change the PHP function, just need to change the shortcode, and setup the attributes "type", "separators", "order", for example:
[my-post-taxonomy type="lieu" separator=" | " order="asc"]
[my-post-taxonomy type="lieu" separator=", " order="desc"]
...

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.