[wp-trac] [WordPress Trac] #48804: Twenty Twenty: Attach template parts with actions instead of directly including

WordPress Trac noreply at wordpress.org
Tue Nov 26 21:42:41 UTC 2019


#48804: Twenty Twenty: Attach template parts with actions instead of directly
including
---------------------------+-----------------------------
 Reporter:  ianbelanger    |      Owner:  (none)
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Bundled Theme  |    Version:  5.3
 Severity:  normal         |   Keywords:  2nd-opinion
  Focuses:                 |
---------------------------+-----------------------------
 Originally requested on GitHub by @thomasplevy

 https://github.com/WordPress/twentytwenty/issues/947

 **The Problem**

 Not all custom post types are created equal. Some custom post types are
 like blog posts where meta information, post author information, and
 navigation between post types makes sense. Other custom post types behave
 more like native pages where navigation between pages is undesirable.

 This is a pretty generic and blanket statement and it's not always true.
 Custom post types are custom and the requirement differ greatly depending
 on the developer creating them.

 I am working to add Twenty Twenty theme support for my plugin
 [LifterLMS](https://github.com/gocodebox/lifterlms) and I have several
 custom post types which I'd like to be able to remove author and custom
 post type navigation for.

 Given the fact that custom post types utilize template at `template-
 parts/content.php` it is currently only possible for me to remove the
 navigation and author information by using custom CSS.

 The meta information I am able to disable using the filter
 `twentytwenty_disallowed_post_types_for_meta_output`.

 **Proposed Solution**

 I'd like to modify the template in question to either be wrapped in a
 filter which allow the inclusion of `template-parts/entry-author-bio.php`
 and `template-parts/navigation.php` to be disabled via a filter.

 For example:

 https://github.com/WordPress/twentytwenty/blob/dea9290e7ca3d38b7067c3b7107787db6554249a
 /template-parts/content.php#L68-L72

 {{{
 if ( is_single() ) {

     get_template_part( 'template-parts/navigation' );

 }
 }}}

 Could become:

 {{{
 if ( is_single() && apply_filters(
 'twentytwenty_display_single_navigation', true ) ) {
     get_template_part( 'template-parts/navigation' );
 }
 }}}

 If this does seem like an acceptable addition I'd be more than happy to
 write and submit the PR but I didn't want to spend time without a blessing
 from a core contrib or maintainer first.

 Thank you for considering this!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48804>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list