WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 6 years ago

Last modified 6 years ago

#5899 closed enhancement (wontfix)

New action -hook for edit.php for plugin authors to create a title

Reported by: nerrad Owned by: westi
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: Editor Keywords:
Focuses: Cc:

Description

For plugin authors hooking into the Manage->posts page it would be nice to be able to create a $h2_[new_title]. (see attached suggestion)

Attachments (3)

edit-h2-action-hook.txt (386 bytes) - added by nerrad 10 years ago.
Suggested code for implementation
edit.php.diff (1.2 KB) - added by nerrad 10 years ago.
Patch for edit.php (plugin hooks for title)
edit.php.2.diff (1.2 KB) - added by nerrad 10 years ago.
Correction so literal string is not a variable. Translation is executed prior to filtering.

Download all attachments as: .zip

Change History (19)

@nerrad
10 years ago

Suggested code for implementation

#1 @lloydbudd
10 years ago

  • Milestone set to 2.6

Please create a patch.

#2 @nerrad
10 years ago

Patch added - any chance of this getting into 2.5? It's just a small change.... (crosses fingers)

#3 @nerrad
10 years ago

  • Keywords has-patch added

#4 @ryan
10 years ago

Filtering the string before translation could break translations. Literal strings, not variables, must be passed to _c().

#5 @nerrad
10 years ago

I've tested it and providing the plugin author hooks in correctly it won't break existing translations.

#6 @ryan
10 years ago

The patch does not mark the literal string for translation thus that string will not be in the POT file.

#7 @nerrad
10 years ago

I'm still confused then, why the existing patch tests successfully with different language files loaded in WP (even after testing with a plugin using the new filter hooks).

Are you saying that automatically generated .pot files will miss this string with the patch (although existing .mo's will work as expected)? Please forgive my lack of knowledge here. Hopefully at least this is a good idea that just needs more work :)

#8 @nerrad
10 years ago

Dang it...just noticed the error I made in the code - it's not the patch I tested lol. Uploading new patch now for eval.

@nerrad
10 years ago

Patch for edit.php (plugin hooks for title)

#9 @ryan
10 years ago

_c( $h2_result_reorder )

This will result in the literal string '$h2_result_order' being placed in the message catalog rather than the actual string we want to be translated. You can only filter a string after it has been translated.

@nerrad
10 years ago

Correction so literal string is not a variable. Translation is executed prior to filtering.

#10 @nerrad
10 years ago

Thanks for the explanation - confirmed what I thought your were meaning but what I still didn't fully understand. Now I do. So, I've translated the string right in the apply_filters call (see new patch/diff). This should work, BUT it will require docs to indicate to plugin authors using this hook that they need to run the translation on the string before returning it. Make sense?

#11 @nerrad
10 years ago

  • Keywords edit.php added; edit removed

#12 @nerrad
10 years ago

  • Keywords action-hook filter-hook needs-testing added; edit.php plugin action hook filter hook removed

#13 @westi
10 years ago

  • Owner changed from anonymous to westi
  • Severity changed from major to normal
  • Status changed from new to assigned

#14 @Denis-de-Bernardy
8 years ago

  • Component changed from Administration to Editor
  • Keywords needs-patch added; has-patch needs-testing removed
  • Milestone changed from 2.9 to Future Release

#15 @solarissmoke
6 years ago

  • Keywords manageposts action-hook filter-hook needs-patch removed
  • Resolution set to wontfix
  • Status changed from accepted to closed

This is quite ancient. There is no longer any <h2> in the posts-filter form.

#16 @dd32
6 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.