https://docs.curlythemes.com/weekly-class-schedule/#free-support
I have created a child theme, created the folders and file as directed and placed the code in the file (customized to my needs). Unfortunately, all I get is the actual code displayed on the screen.
When I place the code in the PHP bracket the screen is just a white screen. I’m supposed to have this to the client this week and I am stumped! Any help/advice will be great. Below is the code I’m using:
add_filter( 'wcs_start', 'myy_custom_start_date', 30, 2 );
function myy_custom_start_date( $date, $options ){
if( intval( $options['id'] ) !== 3 )
return $date;
return strtotime('10/17/2018');
}
add_filter( 'wcs_stop', 'myy_custom_stop_date', 30, 2 );
function myy_custom_stop_date( $date, $options ){
if( intval( $options['id'] ) !== 3 )
return $date;
return strtotime('10/22/2018');
}
]]>
Oh, and when you’re developing, it’s a good odea to set WP_DEBUG to true in your wp-config.php file so that you can see errors like this. ?? Of ocurse, change it back to false when you take the site live.
The error is with your single-quotes. They look fine- don’t they? Well, they aren’t. The second one is not an actual single-quote, but another different character (in this case a backtick) that looks like a quote, so it’s breaking on that. To illustrate where possible…
This one is wrong:
return strtotime ('10/17/2018′);
This one is right:
return strtotime ('10/17/2018');
The difference is tiny, but that’s where the problem is.
]]>I do not see anything syntactically incorrect with the code you posted. Check your error log for additional clues to the cause of the white screen (AKA “WSOD” — white screen of death). Or as catacaustic suggested, define WP_DEBUG as true so the errors appear on your browser.
I don’t know anything about your plugin, but I suspect the timestamp you are returning might be incorrect. Output the initial $date value to see what the expected format is supposed to be. It might possibly be YYYY-MM-DD instead of a timestamp. A wild guess on on my part. What the actual error is will confirm or deny my guess.
]]>