Make WordPress Core

Opened 6 years ago

Last modified 3 weeks ago

#45919 new enhancement

Twenty Nineteen: Improve comments in `twentynineteen_setup`

Reported by: laurelfulford's profile laurelfulford Owned by:
Milestone: Future Release Priority: low
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 (6)

#1 @laurelfulford
6 years ago

  • Milestone changed from Awaiting Review to Future Release

#2 @sabernhardt
4 years 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' );

#3 @karmatosed
7 weeks ago

  • Keywords 2nd-opinion added

@sabernhardt what are your thoughts on this now? I feel they are good to get in if just comments but this also is lower priority and for me at this point could be a close. I'm curious on your input.

#4 @sabernhardt
7 weeks ago

  • Priority changed from normal to low

Yes, it is low priority.

My suggestions seem to do little more than identifying the locations where the two stylesheets and the alignment settings apply. And while I appreciate the Classic Editor, "classic" in the editor-styles comment may not mean much anymore.

#5 @sabernhardt
4 weeks ago

I do not like my previous suggestions anymore. If the comments are changed, they should use terms from https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/

For example, wp-block-styles adds the extra stylesheet of "opinionated" block styles.

Also, the twentynineteen_editor_customizer_styles function docblock could describe how it adds the Primary Color selection (and complementary colors) from the Customizer into the block editor.

#6 @karmatosed
3 weeks ago

  • Keywords 2nd-opinion removed
Note: See TracTickets for help on using tickets.