Skip Navigation

[Resolved] Order by title ignoring quote marks

This support ticket is created 7 years, 1 month ago. 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.

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 replies, has 2 voices.

Last updated by emilyT 7 years, 1 month ago.

Assisted by: Noman.

Author
Posts
#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: English (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!