WordPress.org

Make WordPress Core

Opened 23 months ago

Last modified 5 days ago

#45919 new enhancement

Twenty Nineteen: Improve comments in `twentynineteen_setup`

Reported by: laurelfulford Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.0.2
Component: Bundled Theme Keywords: needs-patch
Focuses: docs Cc:

Description

Originally reported by @joyously in the Twenty Nineteen GitHub repo:

The new interfaces for the editor should be clear and instructive. Many people will look to this theme for "How To" information.

The comments need to indicate what the add_theme_support really does. The call for the old editor should be marked as such.

Currently, it's a bit sparse:

// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );

// Add support for full and wide align images.
add_theme_support( 'align-wide' );

// Add support for editor styles.
add_theme_support( 'editor-styles' );

// Enqueue editor styles.
add_editor_style( 'style-editor.css' );

// Editor color palette.
add_theme_support(
	'editor-color-palette',
		array(
			array(
				'name'  => __( 'Primary Color', 'twentynineteen' ),
					'slug'  => 'primary',
				'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 33 ),
				),
			)
		);

// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );

There is also a separate function for enqueuing twentynineteen-editor-customizer-styles which should have good comments. This handle name is questionable, because it is editor and customizer, so it's confusing. Does it need to say customizer?

If I'm looking at this to figure out how to change my theme for the new editor, I can't really tell what's what.

Copied over from: https://github.com/WordPress/twentynineteen/issues/634

Change History (2)

#1 @laurelfulford
23 months ago

  • Milestone changed from Awaiting Review to Future Release

#2 @sabernhardt
5 days ago

  • Focuses docs added

These comments are the same in Twenty Twenty and Twenty Twenty-One.

Here are suggestions for the first three theme supports:

	// Add support for block-specific styles on the front end.
	add_theme_support( 'wp-block-styles' );

	// Add support for full and wide align images in blocks.
	add_theme_support( 'align-wide' );

	// Add support for editor styles in both classic and block editors.
	add_theme_support( 'editor-styles' );
Note: See TracTickets for help on using tickets.