Skip to content

Instantly share code, notes, and snippets.

@heyjones
Created January 14, 2022 07:14
Show Gist options
  • Save heyjones/0d21f2861bd598643ee751bf44056709 to your computer and use it in GitHub Desktop.
Save heyjones/0d21f2861bd598643ee751bf44056709 to your computer and use it in GitHub Desktop.
<?php
/**
* Provides the css generated by theme.json in WPGraphQL
*/
add_action( 'graphql_register_types', function() {
$field_config = array(
'type' => 'String',
'args' => array(),
'resolve' => function() {
return wp_get_global_stylesheet();
},
);
register_graphql_field( 'RootQuery', 'globalStyles', $field_config );
} );
@heyjones
Copy link
Author

This doesn’t seem to handle the alignment classes, which is expected for WordPress 5.8:

https://make.wordpress.org/core/2021/06/29/on-layout-and-content-width-in-wordpress-5-8/

Curious to see if this is different in 5.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment