Also, since this is for a soccer related website using sportspress, we only chose to show the “Scheduled” posts, since thats what SportsPress upcoming matches post status is. Is there a way to only limit the date to always be today + 2 months? So it always shows sceduled posts from today and until the next 2 months.
Hello redwolfcy,
yes you can use the filter wpcf7_your_tag_name_get_posts filter for this.
Best regards
Markus
@markusfroehlich can you provide an example snippet on how to achieve this?
As mentioned above, I have read all the support posts about custom fields but did not really understand how to achieve this.
Hello redwolfcy,
please take a look of this topic:
https://ww.wp.xz.cn/support/topic/filter-woocommerce-product-with-acf-field/
If this topic wont solve your problem, please write me.
Best regards
Markus
Hello,
I have added
add_filter('wpcf7_yourtag_get_posts', 'filter_dropdown_posts');
function filter_dropdown_posts($post_args){
$post_args['meta_query'] = array(
array(
'key' => 'show_match_in_press_accreditation',
'value' => 'true')
);
return $post_args;
}
to my functions.php but it still brings up the same results, so it appears that the filter does not work…
show_match_in_press_accreditation is my acf field name and it is set as True/False field.
here is my shortcode
[post_select post_select_59 posts-number:6 future include_blank search_box post-type:sp_event tax-relation:OR value-field:title orderby:date order:ASC "%date% - %title% - %meta_key%"]
I have also tried changing the add_filter to
add_filter('wpcf7_post_select_59_get_posts', 'filter_dropdown_posts');
but gives no results at all…
-
This reply was modified 5 years, 8 months ago by
redwolfcy.
-
This reply was modified 5 years, 8 months ago by
redwolfcy.
-
This reply was modified 5 years, 8 months ago by
redwolfcy. Reason: show the shortcode
-
This reply was modified 5 years, 8 months ago by
redwolfcy.
Please check, if the filter works:
add_filter('wpcf7_'.$tag_name.'_get_posts', 'filter_dropdown_posts', 10, 3);
function filter_dropdown_posts($post_args, $tag, $args)
{
print_r($post_args);
return $post_args;
}
Best regards
Markus