Skip Navigation

[Gelöst] Order by title ignoring quote marks

This support ticket is created vor 6 Jahre, 6 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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by emilyT vor 6 Jahre, 6 Monate.

Assisted by: Noman.

Author
Artikel
#575785

Hi, I'm creating a simple list of items sorted alphabetically by title, which you can see here:
hidden link

It's mostly worked, however the first handful of results start with a single quote mark. Is there any way to get the sort order to ignore that first quote mark, for example so that "‘Fender’ Custom Black Stratocaster" appears together with the Fs rather than at the top of the results?

Many thanks, Emily

#575804

Noman
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Emily,

Thank you for contacting Toolset support. We can modify this behaviour through a hook and code.

Please add this code in your theme’s or child theme’s functions.php file:

add_filter( 'wpv_filter_query', 'order_by_name', 999, 3 );
function order_by_name( $query_args, $view_settings, $view_id ) {
	
  	if( $view_id == 4378 ) { // your view id

    	$query_args['orderby'] = 'name';
  	}
  
  return $query_args;
}

==> Please replace “4378” with your View ID and it will work fine.

Thank you

#575973

That worked perfectly, thanks Noman!

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