I am trying to:
Get posts to appear in a results list, where the user has forgotton to enter the date field.
Link to a page where the issue can be seen:
Need to be logged in, but hidden link
I expected to see:
The posts that are missing the date field to be dumped to the bottom of the list by default (or the top possibly)
Instead, I got:
They just don't appear in the list. The list is being ordered 'by date field ascending' - it seems weird that it would just ignore these posts.
Luo Yang
Supporter
Languages:
English (English )
Chinese (Simplified) (简体中文 )
Timezone:
Asia/Hong_Kong (GMT+08:00)
Hello,
Toolset Views plugin is using WordPress PHP class WP_Query to query posts.
This is a limitation of class WP_Query, see wordpress document:
https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters
‘meta_value‘ – Note that a ‘meta_key=keyname‘ must also be present in the query
So if you are order the result by a custom date field, all posts should setup custom date field values, or they won't present in Views result.
In your case, you might consider setup another post view, filter by the "date field" is empty, for example:
https://toolset.com/forums/topic/view-query-exclude-posts-with-a-parent/
and display above post view under the your original view.
Thanks for your reply! I think it's a good idea - however, I'm a little confused about the useage of the PHP block you referenced from the other post.
I've made a new view, which would ideally show all the post results that don't have the date field filled in - however, using the Toolset interface, what is the correct setting to show a date field that has been left blank?
I've tried a few combinations of STRING with the value set to '0' and others, but none of them seem to yield the desired effect.
Best wishes
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Luo is on vacation. This is Minesh here and I'll take care of this ticket in Luo's absence. Hope this is OK.
Do you mean that you have a date custom filed and you want to display the posts where the date field is empty?
If yes:
can you please share problem URL where you added the view as well as access details and for what field I need to look at?
*** 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.