.wp-block-group, .wp-site-blocks > .alignfull { max-width: none; } body > .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: {$c_max}px; } CSS; return sprintf( $css, gmdate( 'Y-m-d H:i:s' ) ); } /** * Write the generated CSS file to disk. * * @return bool|WP_Error True on success, WP_Error on failure. */ function oribi_write_generated_css() { $css = oribi_build_css(); $path = oribi_generated_css_path(); // Ensure directory exists. $dir = dirname( $path ); if ( ! file_exists( $dir ) ) { wp_mkdir_p( $dir ); } // Use WP_Filesystem for safe file writing. require_once ABSPATH . 'wp-admin/includes/file.php'; global $wp_filesystem; if ( ! WP_Filesystem() ) { return new WP_Error( 'fs', __( 'Could not initialise filesystem.', 'ots-theme' ) ); } $result = $wp_filesystem->put_contents( $path, $css, FS_CHMOD_FILE ); if ( ! $result ) { return new WP_Error( 'write', __( 'Could not write generated CSS file.', 'ots-theme' ) ); } // Bump version number so browsers cache-bust. $version = intval( get_theme_mod( 'oribi_css_version', 0 ) ) + 1; set_theme_mod( 'oribi_css_version', $version ); return true; } /** * Regenerate the CSS file if it doesn't exist yet (e.g. first page load). * * Hooked early so the file is ready before wp_enqueue_scripts fires. */ add_action( 'init', function () { if ( ! file_exists( oribi_generated_css_path() ) ) { oribi_write_generated_css(); } } );