Forgiveness Doesn’t Excuse Their Behavior

function tinybuddha_get_custom_css_file_path() { return get_stylesheet_directory() . '/css/custom-theme-options.css'; } function tinybuddha_sync_custom_css_file() { $css = (string) get_option( 'dm_custom_css', '' ); $css = trim( $css ); $file_path = tinybuddha_get_custom_css_file_path(); $dir_path = dirname( $file_path ); if ( ! is_dir( $dir_path ) ) { $created = wp_mkdir_p( $dir_path ); if ( ! $created ) { update_option( 'tinybuddha_custom_css_file_error', 1, false ); return false; } } $written = file_put_contents( $file_path, "/* Tiny Buddha custom theme options CSS */ " . $css . " " ); if ( false === $written ) { update_option( 'tinybuddha_custom_css_file_error', 1, false ); return false; } delete_option( 'tinybuddha_custom_css_file_error' ); return true; } function tinybuddha_maybe_sync_custom_css_file() { if ( is_admin() ) { tinybuddha_sync_custom_css_file(); } } add_action( 'init', 'tinybuddha_maybe_sync_custom_css_file', 20 ); function tinybuddha_custom_css_file_admin_notice() { if ( ! current_user_can( 'manage_options' ) ) { return; } if ( ! isset( $_GET['page'] ) || 'theme-options.php' !== $_GET['page'] ) { return; } $file_path = tinybuddha_get_custom_css_file_path(); if ( ! get_option( 'tinybuddha_custom_css_file_error' ) && file_exists( $file_path ) && is_writable( $file_path ) ) { return; } echo '
'; echo esc_html__( 'Tiny Buddha could not write custom CSS to wp-content/themes/tinybuddha/css/custom-theme-options.css. Styles will be loaded inline as a fallback.', 'tinybuddha' ); echo '

Count your blessings with Tiny Buddha’s Gratitude Journal! Pre-order here.