I am trying to write some PHP code that filter the results after the view query has been executed. But I can't seem to find a hook within the documentation that does this. So to be clear, I want to filter the result using some custom PHP code right before they are displayed on the page.
So what I am looking for is a list of all $items inside the view that I can loop through and change.
Is there any documentation that you are following?
As you can see from the description it hooks into the wordpress query before the database is accessed to pre filter the listing before it is displayed on the page.
Is it that you are having issues getting the filter query itself to run ?
I tried finding a solution using this hook, but can't seem to get it to work. I will try to explain what I am doing because maybe there is a better solution.
Currently, I have a custom post-type company inside this post-type I have a repeating field 'Alternative business hours' this repeating fields contains a date and a text field (where the user can enter the alternative business hours). Now I am trying to create a view that show all the store that have alternative business hours this Sunday.
yes that's exactly what I am trying to accomplish.
I have tried using a filter on the date field in the reaping field, but this doesn't return any results. Even when there are openings time registered for that particular date.
Would you mind allowing me to have access to the site so that I can have a look at this for you ?
I doubt that it will be possible because you're essentially filtering a Parent by its child. While you're able to filter the child by the parent, the opposite doesn't hold true especially for repeating field groups.
However I will need to see your dataset to see if there are any possiblities.
The solution here might just be to mark the business themselves as open or closed or open using perhaps a checkbox and then filter based the post directly rather than doing it through the relationship.
Given that you have the custom fields for the days on the Business post type itself, you can simply write a hook to check that field and ensure that the respective field is not defined as closed based on the current day.
Lets say if you're currently on Tuesday, then you will check the tuesday field to ensure that it isn't equal to closed. If its not then you'll display that business.