No - you can not create a parametric search filter that way.
But if you share exact information, based on which field you are deciding that post is old or new. I believe if its custom date field then view's filter wpv_filter_query might be helpful here but I need problem URL and temporary access.
*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
I checked the source code of your theme file functions.php, the source code of shortcode [validite], PHP codes:
/**************************************************
* Shortcode pour déterminer si une offre est valide maintenant
**************************************************/
function determiner_validite_offre( ) {
$post_id = get_the_ID();
$date_emission = get_post_meta($post_id,'wpcf-date-d-emission-de-l-offre', true);
$duree_validite = get_post_meta($post_id,'wpcf-duree-de-validite', true);
$date_expiration = get_post_meta($post_id,'wpcf-date-d-expiration-de-l-offre', true);
$maintenant = current_time( 'timestamp' );
if ($date_expiration < ($maintenant)) {return "Expirée";} else {return "Valide";}
}
add_shortcode( 'validite', 'determiner_validite_offre' );
It is checking custom field "wpcf-date-d-expiration-de-l-offre" value, if it is bigger than current time, then display "Valide", else display "Expirée"
I assume you are going to select menu with three options:
"all offers", "only valid offers", "only expired offers"
Since the custom field "wpcf-date-d-expiration-de-l-offre" stores value as time stamp value, which is numeric value, so there isn't such a built-in feature within Views plugin to display as what you want.
In your case, it needs custom PHP codes, you can apply your custom filters with Views filter hook "wpv_filter_query", But since it is not built-in feature of Views plugin, the option " Show only available options for each input" will not work with the custom PHP codes, please let me know if you still need assistance to apply such kind of custom PHP codes.
In deed I really don't understand how to build the PHP code to make my filter work.
If I understand well, to make the filter work in parametric search, I would need to also add a generic field, that would be populated by the PHP filter ?
Yes, you are right, for example:
1) In the custom search form, you will need to add a dropdown menu with options:
"all offers", "only valid offers", "only expired offers"
User can use it to choose one of option, after submit the form, it will pass specific URL parameter to the view
2) In server side, you can setup custom PHP codes with Views filter hook "wpv_filter_query", when user submit the custom search form, it will trigger a custom PHP function, in this PHP function, check the pecific URL parameter, if it is option "only valid offers", then filter the view by this:
Custom field "wpcf-date-d-expiration-de-l-offre" value is greater than current time value.
It is the forum system who are going to close this thread. I mark it as status "Waiting for user feedback", please update this thread when you need more assistance, thanks