Mark
February 1, 2020, 2:24pm
21
Sorry if i appear a bit slow.
Admin page saves dates to database.
some php code runs when order page loads gets dates from database using
wp_localize_script to make them available to the .js file
.js file is edited to use the data from wp_localize_script
james
February 1, 2020, 2:52pm
22
Yes exactly. wp_localize_script
just makes PHP data available as a JS variable. You can see an example of how to use it here: wp_localize_script() | Function | WordPress Developer Resources
1 Like
Mark
February 1, 2020, 3:01pm
23
Ok
I will use this as my outline plan and report back once it is working, or, more likely, when I have further questions or run into problems
2 Likes
Simone
February 1, 2020, 3:18pm
24
wp_localize_script
is very easy to use. Maybe the name is misleading, but in the same way you can pass a variable with translated strings you can pass an array of dates to exclude.
timkaye
February 1, 2020, 4:45pm
25
I am a great fan of mu-plugins
and use them all the time, though I do like to put the following line right at the top:
<?php if( ! defined( 'ABSPATH' ) ) { die(); }
2 Likes