Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Jen

Unable to sort or filter Piklist custom field

Hi there

We have created a custom field called “Featured” which is a single choice checkbox. Details below.

piklist('field', array(
'type' => 'checkbox',
'field' => 'post_featured',
'label' => '',
'choices' => array(
'featured' => 'Feature this post'
)
));

I purchased this plugin to specifically enable our editors to sort and/or filter posts by whether they are ‘featured’ or not as we have 2,000+ posts.

When I select True/False field type, the featured posts display with a tick/check and unfeatured posts display with a cross (x).

However, I am unable to sort or filter to display just the ticks/featured. Can you please advise the best way to achieve this?

Thanks
Jen

7 years ago
Stefan van den Dungen Gronovius
Developer

Hi Jen,

Thanks for the feedback.
Although I’m not really familiar with Piklist and we don’t officially support this plugin, I try to help you as best as I can.

Can you tell me what value is stored in the database when you enable the checkbox and when you unchecked the checkbox?

Both filtering and sorting should work for Custom Field columns with type set to True/False. Both maybe you’re also sorting on another column. Can you check if you see the ‘reset sorting’ button on top of your table? If so, can you click on this button? Also notice that by default all empty or false values are removed on sorting. You can change this in our settings page.

If you still have some problems, can you tell me what results you get when you sort or filter on your custom field column?

7 years ago
Jen

Hello Stefan

In the database the meta_value for post_featured is either ‘featured’ when checked or empty when not checked.

Sorting
When I click the column title “Featured” twice to sort that column, it does not put the ticks up top. I tried to click Reset Sorting and same results.

Filtering
When I try to filter by “True” – it returns 0 results when it should show 30 featured posts.
When I choose “False” it returns all posts that are published (1233 results)
When I choose “All” it displays all posts including drafts and scheduled (1245 results)

I can’t find the settings you refer to:

“Also notice that by default all empty or false values are removed on sorting. You can change this in our settings page.”

I did try checking this box: Show all results when sorting. Default is off. BUT still no luck.

Any ideas?

Thanks
Jen

7 years ago
Jen

Actually – I just worked out if I choose type as “Has Content” I can then filter by “featured”. All is good.
Thanks

7 years ago
Stefan van den Dungen Gronovius
Developer

Hi Jen,

Thanks for the feedback. Great the issue is fixed now.
I will close this topic.

7 years ago

You must be logged in to reply to this topic.