Opened 3 years ago

Last modified 2 years ago

#11469 new enhancement

Additional Admin UI hooks / filters

Reported by: johnl1479 Owned by:
Priority: normal Milestone: Future Release
Component: Administration Version: 2.9
Severity: normal Keywords: has-patch
Cc: Denis-de-Bernardy, johnl1479, WordPress@…, mikeschinkel@…, ramiy, maorb

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 3 years ago.
11469-2.diff (1.0 KB) - added by johnl1479 3 years ago.
11469-3.diff (1.0 KB) - added by johnl1479 3 years ago.
11469-4.diff (1019 bytes) - added by johnl1479 3 years ago.

Download all attachments as: .zip

Change History (24)

  • Milestone changed from Unassigned to 2.9
  • 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.

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

comment:4 follow-up: ↓ 6   hakre3 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.

  • Cc Denis-de-Bernardy added

comment:6 in reply to: ↑ 4   johnl14793 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.

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

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

Patch #3 fixes a typo

comment:9 follow-up: ↓ 10   scribu3 years ago

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

comment:10 in reply to: ↑ 9   azaozz3 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.

  • 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 __().)

comment:12 follow-up: ↓ 18   johnl14793 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

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.

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from 3.0 to Future Release
  • Cc WordPress@… added
  • Cc mikeschinkel@… added

comment:18 in reply to: ↑ 12   ramiy2 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.

  • Cc ramiy added
  • Cc maorb added

+1 to make these meta box as well.

Note: See TracTickets for help on using tickets.