How can we sort view result, depend on cookie set or not I have created a view to display slideshow from specific content type.

Now I have a condition that if visitor is new then slideshow will sort according to custom field "slider order".
And if user visited already then slideshow will sort according to post date.

I have tried this from "hook_views_query_alter" but I want this to be done from view only.

I applied some custom sorting in views but not working (actually I have no idea about custom sorting in views)

Please let me know the conditions.

Fields: title, description, Image

Filter: content type= slider

Sorting: Post date (desc)   [here I need your help]
For any field you want to pull a value from a Cookie you add an exposed filter, here I add a contextual filter for the field, here a node-&gt;title:


Then we configure the filter to pull a value from the URL. If none is provided we define how to find the value via PHP code. This is the secret to pulling the value from a $_COOKIE value.




Then we supply a blurb of code to read the Cookie value: