[wp-trac] [WordPress Trac] #14808: Add Editor Documentation Functions URL for theme-defined functions
WordPress Trac
wp-trac at lists.automattic.com
Tue Aug 23 15:04:02 UTC 2011
#14808: Add Editor Documentation Functions URL for theme-defined functions
-------------------------+-----------------------------
Reporter: GamajoTech | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: needs-patch |
-------------------------+-----------------------------
Changes (by GaryJ):
* cc: gary@… (added)
Comment:
First attempt at adding a filter here.
* esc_url() may or may not be the right escape here.
* The filter name may need to be a less general name if the plugin editor
can't be filtered with the same signature.
* The current theme and file path are passed as arguments, so the URL can
be changed conditionally.
* It may be that passing the full path as the $file is not helpful, and
can perhaps be trimmed down to be a relative path from the theme folder.
Themes could now filter the URL as per normal:
{{{
add_filter( 'documentation_url', 'child_documentation_url', 10, 3 );
/**
* Filter the function documentation URL in theme editor.
*
* @param string $url
* @param string $theme Name of the theme
* @param string $file full path of the file being edited
* @return string
*/
function child_documentation_url( $url, $theme, $file ) {
if ( 'My Awesome Theme' != $theme )
return $url;
return 'http://my.example.com/?theme= ' . $theme . '&function=';
}
}}}
It would then be up to the script at my.example.com to check the function
name against a list of known functions for that theme (or at least ones
they want to provide documentation for - could even provide more detailed
documentation for WP functions) and redirect to their own documentation,
or redirect back to api.wordpress.org/code/handbook/1.0/?function=
accordingly.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14808#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list