[wp-meta] [Making WordPress.org] #2789: wporg-developer theme: pass $post when applying 'get_the_excerpt' filter

Making WordPress.org noreply at wordpress.org
Thu Apr 27 01:03:13 UTC 2017


#2789: wporg-developer theme: pass $post when applying 'get_the_excerpt' filter
---------------------------+-----------------
 Reporter:  pbiron         |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:
Component:  Developer Hub  |   Keywords:
---------------------------+-----------------
 In the current version of the ''wporg-developer'' theme (I just checked
 out the trunk today, as described in
 [[https://make.wordpress.org/docs/handbook/developer-resources/devhub/#1
 -install-the-theme|Devhub: Install the theme]]), `reference/template-
 methods.php` contains the following:
 {{{#!php
 <?php if ( $excerpt = apply_filters( 'get_the_excerpt',
 $child->post_excerpt ) ) {
 }}}
 and I think it would be best to change that to:
 {{{#!php
 <?php if ( $excerpt = apply_filters( 'get_the_excerpt',
 $child->post_excerpt, $child ) ) {
 }}}
 now that
 [[https://developer.wordpress.org/reference/hooks/get_the_excerpt/|get_the_excerpt]]
 allows passing the post as the 2nd param.

 I'm currently developing a documentation system for the plugins/themes I
 write (using [[https://github.com/WordPress/phpdoc-parser|WP-Parser]] and
 a child of ''wporg-developer'', leveraging my user's familiarity with
 DevHub).  Another plugin that is active as part of that documentation
 system '''also''' hooks into `get_the_excerpt` and the hooked function
 relies on the `$post` param (defaulting to the current post).

 In the context in which ''wporg-developer'' applies `get_the_excerpt` in
 `reference/template-methods.php`, the current post is the post for the
 class whose method is being output.  As a result, the "Methods" section of
 for a class in my documentation system contains the "summary" for the
 class as the "summary" for each method of that class.

 This change is probably not strictly necessary for the use of ''wporg-
 developer'' on the DevHub itself.  However, given that ''wporg-developer''
 appears to be written to encourage folks like me to create child themes
 based on it (given all the uses of `if (!function_exists())` in `inc
 /template-tags.php`) I think the suggested change is warranted and it
 would greatly easy the creation of this child theme.

--
Ticket URL: <https://meta.trac.wordpress.org/ticket/2789>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list