Open aManNamedJed opened 6 years ago
Just to help out, so I'm not just an angry troll:
Register my filter to get the events and pass them down
add_filter('cf7_custom_get_events', function($choices, $args = []){
$events = get_posts("post_type=event&posts_per_page=-1");
echo "<pre>";
var_dump($events);
die;
echo "</pre>";
$choices = array(
'-- Make a Selection --' => '',
'Choice 1' => 'Choice 1',
'Choice 2' => 'Choice 2',
'Choice 3' => 'Choice 3',
'Choice 4' => 'Choice 4',
'Choice 5' => 'Choice 5'
);
return $choices;
}, 10, 2);
Then within the CF7 Form, give it that filter I passed in as the first parameter
[dynamicselect event "cf7_custom_get_events"]
[submit "Send"]
Yes, the documentation on how to use is a bit lacking. I will gladly accept put request if anyone wants to help contribute.
I created a PR for you. I hope this helps:
https://github.com/Hube2/contact-form-7-dynamic-select-extension/pull/10
The plugin may or may not even work. The documentation you have provided is all over the place, and none of your screenshots even match your code examples. Can you please update your documentation to be consistent across the board? It's not clear how to get this working. I am debugging the code and still have no idea.