WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 6 years ago

#11469 closed enhancement (fixed)

Additional Admin UI hooks / filters

Reported by: johnl1479 Owned by:
Milestone: 3.4.2 Priority: normal
Severity: normal Version: 2.9
Component: Plugins Keywords: has-patch 2nd-opinion
Focuses: administration Cc:
PR Number:

Description

Some might classify this as overkill, others as making Wordpress as completely extendable as people want it.

I'd like to propose the addition of numerou hooks to the Wordpress core Admin UI which would allow the addition of UI elements outside of the current constraints, such as meta boxes.

If that doesn't make sense, I have an example to illustrate:

Given the "Subtitle" example from http://digwp.com/2009/10/ideas-for-plugins/, there would be a new hook named "edit_post_form_after_title" (or something along those lines) which would be placed directly after the post title is displayed on the screen and allow a plugin developer to insert a text field for a subtitle directly below the title field. See the attached patch.

Attachments (4)

edit-form-advanced.diff (605 bytes) - added by johnl1479 10 years ago.
11469-2.diff (1.0 KB) - added by johnl1479 10 years ago.
11469-3.diff (1.0 KB) - added by johnl1479 10 years ago.
11469-4.diff (1019 bytes) - added by johnl1479 10 years ago.

Download all attachments as: .zip

Change History (28)

#1 @johnl1479
10 years ago

  • Milestone changed from Unassigned to 2.9

#2 @nacin
10 years ago

  • Component changed from General to Administration
  • Milestone changed from 2.9 to Future Release

2.9 is now a release candidate, so enhancements belong in a future release.

#3 @scribu
10 years ago

  • Keywords has-patch added
  • Milestone changed from Future Release to 3.0
  • Version set to 2.9

#4 follow-up: @hakre
10 years ago

I like the Idea, but wouldn't it be more adviseable to add a filter for the main title input element so it can be changed / extended? Or at least to do these two changes in pair.

#5 @Denis-de-Bernardy
10 years ago

  • Cc Denis-de-Bernardy added

#6 in reply to: ↑ 4 @johnl1479
10 years ago

Replying to hakre:

I like the Idea, but wouldn't it be more adviseable to add a filter for the main title input element so it can be changed / extended? Or at least to do these two changes in pair.

Yes, it probably would be a better idea to take that approach, I just threw that patch together to illustrate my point.

@johnl1479
10 years ago

#7 @johnl1479
10 years ago

  • Cc johnl1479 added
  • Summary changed from Additional hooks to Additional Admin UI hooks / filters

I implemented this as a filter, per hakre's suggestion.

@johnl1479
10 years ago

#8 @johnl1479
10 years ago

Patch #3 fixes a typo

#9 follow-up: @scribu
10 years ago

For 11469-3.diff you should use heredoc syntax.

#10 in reply to: ↑ 9 @azaozz
10 years ago

Perhaps this should be part of the UI changes for custom post types. Most of the "add/edit post" screen is already customizable (with the metaboxes), the three items remaining are the editor, title and JS permalink. They should probably be kept in one area (another metabox?) and new hooks added to each so plugins can add other elements there or disable/change them.

#11 @nacin
10 years ago

  • Keywords needs-patch added; has-patch removed

Needs patch. Either we make it a meta box (+1), or the new patch should be written so we're not escaping quotes throughout. Heredoc would work, but it's not used anywhere in core, and there's nothing wrong here with using single quotes (either for PHP, or for the HTML attributes). (Also, _e() would need to become __().)

#12 follow-up: @johnl1479
10 years ago

Patch has been rewritten to use heredoc and single quotes (old habits die hard ;))

I like the idea of having each of those elements in a meta box like the rest of the elements on the screen (as in they can moved around as the user desires), however, I feel that it might be a little cluttered, and ultimately unnecessary to the see the collapsible headers current meta boxes have with the three vital elements to the screen

@johnl1479
10 years ago

#13 @nacin
10 years ago

I think azaozz meant that the three elements could be added to a single meta box.

Also, what I meant by single quotes is:

$titlediv = "<div id='titlewrap'>";
$titlediv .= "\t<label class='screen-reader-text' for='title'>" . __('Title') . "</label>";
$titlediv .= "\t<input type='text' name='post_title' size='30' tabindex='1' value='" . esc_attr( htmlspecialchars( $post->post_title ) ) . "' id='title' autocomplete='off' />";
$titlediv .= "</div>";

Or reversed, using double quotes for HTML attributes, and single quotes for PHP strings. Both ways are acceptable WP coding standards.

#14 @johnl1479
10 years ago

  • Keywords has-patch added; needs-patch removed

#15 @nacin
10 years ago

  • Milestone changed from 3.0 to Future Release

#16 @voyagerfan5761
10 years ago

  • Cc WordPress@… added

#17 @mikeschinkel
10 years ago

  • Cc mikeschinkel@… added

#18 in reply to: ↑ 12 @ramiy
9 years ago

Replying to azaozz:

Most of the "add/edit post" screen is already customizable (with the metaboxes), the three items remaining are the editor, title and JS permalink.

Replying to nacin:

make it a meta box (+1).

Replying to johnl1479:

I like the idea of having each of those elements in a meta box like the rest of the elements on the screen (as in they can moved around as the user desires)


if all the elements will use meta boxes, we won't need the "Subtitle" (like suggested in http://digwp.com/2009/10/ideas-for-plugins/) we can move the excerpt meta boxes above the editor and it will use as subtitle.

#19 @ramiy
9 years ago

  • Cc ramiy added

#20 @maorb
9 years ago

  • Cc maorb added

+1 to make these meta box as well.

#21 @ocean90
6 years ago

  • Component changed from Administration to Plugins
  • Focuses administration added

#22 follow-up: @ocean90
6 years ago

  • Keywords 2nd-opinion added

We have now edit_form_top (#24861), edit_form_after_editor (#19658) and edit_form_after_title #21391.

Not sure if a filter for the title is needed.

#23 in reply to: ↑ 22 ; follow-up: @Denis-de-Bernardy
6 years ago

Replying to ocean90:

We have now edit_form_top (#24861), edit_form_after_editor (#19658) and edit_form_after_title #21391.

Not sure if a filter for the title is needed.

edit_post_form_after_title or something to that order is interesting. Last I checked, you can only hook things *after* the content editor, not between the title editor and the content editor. (Or for that matter, disable either of the two or the url editor.)

#24 in reply to: ↑ 23 @helen
6 years ago

  • Milestone changed from Future Release to 3.4.2
  • Resolution set to fixed
  • Status changed from new to closed

Replying to Denis-de-Bernardy:

edit_post_form_after_title or something to that order is interesting. Last I checked, you can only hook things *after* the content editor, not between the title editor and the content editor. (Or for that matter, disable either of the two or the url editor.)

I would check again. As ocean90 pointed out, edit_form_top, edit_form_after_title, and edit_form_after_editor exist now. So does remove_post_type_support().

I think we're good here. Closing as fixed in 3.5, when we added the after title and editor ones.

Note: See TracTickets for help on using tickets.