Skip Navigation

[Resolved] Order by title ignoring quote marks

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.

This topic contains 2 replies, has 2 voices.

Last updated by emilyT 4 years, 2 months ago.

Assigned support staff: 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!