Skip Navigation

[Resolved] Display featured listing first

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 1 voice.

Last updated by tonjt 3 weeks, 1 day ago.

Assisted by: Minesh.

Author
Posts
#2809380

In a geo based directory I'm showing, at the city level, the businesses in that city.
I would like to show first the featured business (there can be at maximum one at a time for a city) and then the others, not really matter their order.
The featured listing has a checkbox custom field flagged (value=1 if flagged, 0 if not)

If I set the display order by the 'featured' field, whichever type (string/number/native cf), only the featured business is shown but not all the others...

#2809382

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

That is because when you set the view to roder by custom field, it will only recognize the results where custom field value is present/available.

There are multiple ways to fix this, either you can create two views, one that displays featured posts first and another view to display non-feature posts.

If you do not want to go with multiple views, then we will have to add custom hook that should merge both featured and non-featured posts.

Can you please let me know with what option you would like to go with.

If you want to use single view, then I will require problem URL wherey you added your view and admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2809386

It seems to me the simpler way (also for me to manage it in the future) is creating 2 views.
Should I order the first by the featured CF and the second excluding the featured listing with a filter?

#2809387

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - that's correct.

#2809388

Ok, thank you Minesh, I'll try this way

#2809428

Sorry, I was too optimistic 🙂

Now I have 2 views, the first correctly showing the 'featured' listing

Order by : Field - In evidenza - Ascending - As a number

and the other one, duplicated from the first one, without this ordering but with

Order by: Post title - Ascending

And all the items are showing.
If I add the Custom field filter to not show the featured listing in this view

Select items with field: In evidenza is a boolean/number/string equal to 0 (or different from 1)

No items are found

#2809498

I got it working updating in bulk all the other businesses and changing the checkbox to a radio 🙂