Skip Navigation

[Resolved] order by don't work

This support ticket is created 7 years, 6 months 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by jensA 7 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#447536
orderby.jpg

Hi Support

I have a problem with the sort function om my site: hidden link

I have a bootstrap grid with a list of affiliate product. I try to sort the list after the fields: "popularitet", "minrente" and "minaop" but when I make a sort, the list is sorted after post_date. When I try to enable the debug mode under tools/settinge I can see the result in the screenshot i have attach in the jpg file.
somehow the orderby change from "popularite"t to "post_date" between "Filter arguments before the query using wpv_filter_query" and "Filter the returned query using wpv_filter_query_post_process". What ame I doing wrong?

I am using the view vith loop
[wpv-layout-start]
[wpv-items-found]
<div class="row list-header sb_sorterbar">
<div class="col-sm-3 col-md-3 col-lg-3">[wpml-string context="wpv-views"]<h4 style="color:#ffffff"><p style="text-align:left;">Sorter:</p></h4>[/wpml-string]
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
[wpv-heading name="popularitet"] [wpml-string context="wpv-views"]<h4 style="color:#ffffff">Popularitet</h4>[/wpml-string][/wpv-heading]
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
[wpv-heading name="minrente"] [wpml-string context="wpv-views"]<h4 style="color:#ffffff">Laveste rente</h4>[/wpml-string][/wpv-heading]
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
[wpv-heading name="minaop"] [wpml-string context="wpv-views"]<h4 style="color:#ffffff">Laveste ÅOP</h4>[/wpml-string][/wpv-heading]
</div>
</div>
<!-- wpv-loop-start -->
<div class="container-fluid wpv-loop js-wpv-loop">
<wpv-loop wrap="1" pad="true">
[wpv-item index=1]
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">[wpv-post-body view_template="Loop item in SearchLaanelisteView"]</div>
</div>
[wpv-item index=pad]
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"></div>
[wpv-item index=pad-last]
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"></div>
</wpv-loop>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

#447866

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Jens

These custom fields you are using, e.g. popularitet, are they Types custom fields or do they come from another plugin?

I created a quick test with a Restaurant custom post type and a Rating custom field.

I used the Loop Wizard to auto-generate the output using a sortable table, and it worked as expected.

Stripping away all of the extraneous markup (the output is generated as a <table>) leaves me with this:

[wpv-items-found]
	<!-- wpv-loop-start -->
	[wpv-heading name="post-title"]Post title[/wpv-heading]
	[wpv-heading name="post-date"]Post date[/wpv-heading]
	[wpv-heading name="types-field-rating"]Rating[/wpv-heading]
		<wpv-loop>
			[wpv-post-body view_template="Loop item in List restaurants with ratings"]
		</wpv-loop>
	<!-- wpv-loop-end -->
[/wpv-items-found]

Note the format for [wpv-heading] when using a Types custom field.

In further testing I tried adding non-Types custom fields using the Loop Wizard and it left the name argument blank. Sorting results in Views is only supported for Types custom fields, and not for custom fields which come from 3rd party plugins.

#450145

I am using a bootstrap grid is not a table. It's probably the reason it does not work

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