[wp-trac] [WordPress Trac] #45984: Twenty Nineteen: Improve code organisation in template-functions.php
WordPress Trac
noreply at wordpress.org
Mon Jan 14 16:53:13 UTC 2019
#45984: Twenty Nineteen: Improve code organisation in template-functions.php
---------------------------+------------------------------------------
Reporter: allancole | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bundled Theme | Version:
Severity: normal | Keywords: needs-patch good-first-issue
Focuses: |
---------------------------+------------------------------------------
Originally reported by @grapplerulrich in the Twenty Nineteen GitHub repo:
The header in the `template-functions.php` file is described as:
> Functions which enhance the theme by hooking into WordPress
According to that description, all of the functions within `template-
functions.php` should hook into either a filter or an action of WordPress.
This is not the case for the following functions:
• `twentynineteen_can_show_post_thumbnail()`
• `twentynineteen_image_filters_enabled()`
• `twentynineteen_post_thumbnail_sizes_attr()`
• `twentynineteen_get_avatar_size()`
• `twentynineteen_is_comment_by_post_author()`
• `twentynineteen_get_discussion_data()`
• `twentynineteen_hsl_hex()`
These are helper functions that would fit best in another file like `inc
/helper-functions.php`.
Also, `twentynineteen_add_dropdown_icons()` could be moved to `icon-
functions.php` to join `twentynineteen_nav_menu_social_icons()`.
Original ticket here:
https://github.com/WordPress/twentynineteen/issues/548
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45984>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list