Skip to content

Commit

Permalink
Theme Support: use a unique gutenberg key for all the gutenberg the…
Browse files Browse the repository at this point in the history
…me support features
  • Loading branch information
youknowriad committed Jul 31, 2017
1 parent 8e59165 commit dbc8680
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ Some advanced block features require opt-in support in the theme itself as it's
Some blocks such as the image block have the possibility to define a "wide" or "full" alignment by adding the corresponding classname to the block's wrapper ( `alignwide` or `alignfull` ). A theme can opt-in for this feature by calling:

```php
add_theme_support( 'wide-images' );
add_theme_support( 'gutenberg', array(
'wide-images' => true,
) );
```
3 changes: 2 additions & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,9 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
);

// Initialize the editor.
$gutenberg_theme_support = get_theme_support( 'gutenberg' );
$editor_settings = array(
'wideImages' => get_theme_support( 'wide-images' ),
'wideImages' => $gutenberg_theme_support ? $gutenberg_theme_support[0]['wide-images'] : false,
);
wp_add_inline_script( 'wp-editor', 'wp.api.init().done( function() {'
. 'wp.editor.createEditorInstance( \'editor\', window._wpGutenbergPost, ' . json_encode( $editor_settings ) . ' ); '
Expand Down

0 comments on commit dbc8680

Please sign in to comment.