WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 5 months ago

#31924 new enhancement

Use add_theme_support( 'more-tag' ) to control display of More Tag button in TinyMCE

Reported by: mrwweb Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:
PR Number:

Description

The More Tag (i.e. <!--more-->) can be inserted with a button that is in the top row of the TinyMCE editor by default. However, it's possible to build a theme where the More Tag has no functionality: a theme that uses the_excerpt() on all archive pages, the page for posts, and search results.

It's a bad user experience for WordPress to display a button if it cannot have any effect on the display of content. Therefore, I think the best way to handle this would be to add a new add_theme_support() value of more-tag. This would still let themes opt-in any time it makes sense, but wouldn't clutter up the editor with pointless buttons.

Change History (10)

#1 @DrewAPicture
5 years ago

  • Version trunk deleted

#2 follow-up: @ramiy
5 years ago

The same can be argued for <!–nextpage–> tag.

#3 @ramiy
5 years ago

  • Component changed from General to Themes
  • Focuses template added

If anything, I would suggest a more comprehensive solution - using add_theme_support( 'editor-tags' ) for different kind of tags.

$args = array(
   '<!--more-->'     = true,
   '<!-–nextpage-–>' = true,
);
add_theme_support( 'editor-tags', $args );

By default they will be enabled, and theme authors can disable those tags if they are not in use.

#4 in reply to: ↑ 2 ; follow-up: @mrwweb
5 years ago

Replying to ramiy:

The same can be argued for <!–nextpage–> tag.

The More Tag is associated with a button in the editor which is what I'm interested in removing when unused. That's not the case for <!-nextpage-> which has no associated button, so I don't see the purpose functional purpose of supporting <!-nextpage-> or not with add_theme_support(). What would WordPress do with that knowledge?

#5 in reply to: ↑ 4 ; follow-up: @obenland
5 years ago

  • Focuses template removed

Replying to mrwweb:

The More Tag is associated with a button in the editor which is what I'm interested in removing when unused.

Nothing stops you from removing that button, there's a filter for it.

I think users should always be able to use the more tag, even in the (edge)case of a theme not making use of it. Themes are temporary, while the current one might not make use of it, the next one probably will.

#6 in reply to: ↑ 5 ; follow-up: @mrwweb
5 years ago

Replying to obenland:

Themes are temporary, while the current one might not make use of it, the next one probably will.

That same argument could be made against add_theme_support( 'post-formats' ) and add_theme_support( 'post-thumbnails' ) couldn't it? The point of the suggestion is to reduce unused features that are just clutter when a theme doesn't support them.

#7 in reply to: ↑ 6 @obenland
5 years ago

Replying to mrwweb:

That same argument could be made against add_theme_support( 'post-formats' ) and add_theme_support( 'post-thumbnails' ) couldn't it?

Good point.

In this case add_theme_support() seems to be the wrong tool for its lack backwards compatibility. Existing themes wouldn't declare support for the more tag, so the would disappear for all of them. I'm sure we could find a clever way to hack around that, but the easiest way for an edge case like this would still be to remove the buttons on the right mce filter, IMO.

#8 @pavelevap
4 years ago

What about conditionally disable More tag (button), for example for pages and other post types without archives? I noticed some users recently which were using it in pages and searched why it it not working...

#9 @mrwweb
4 years ago

@pavelevap In theory, I like that idea but I suspect that would actually cause *more* confusion if the editor is different depending on post type. I also imagine there are people with custom implementations that use the more tag on Pages or other non-archive post types for some other reason.

#10 @pavelevap
4 years ago

@mrwweb: Right, good point. But what about:

1) Disable More tag button for Pages only for new installs?

2) And replace it by missing Nextpage button?

New users will see different buttons for Posts and Pages, but More button will work for Posts and Nextpage button will work for Pages and there will be less confusion. Some users are searching for missing Nextpage button and some are asking about not working More button for Pages. This could be win-win situation? At least for Posts and Pages?

Note: See TracTickets for help on using tickets.