[wp-trac] [WordPress Trac] #41564: Search for hyphenated post templates for post types with underscores
WordPress Trac
noreply at wordpress.org
Mon Aug 7 02:54:29 UTC 2017
#41564: Search for hyphenated post templates for post types with underscores
-------------------------------------------------+-------------------------
Reporter: desrosj | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting
Component: Posts, Post Types | Review
Severity: normal | Version:
Keywords: dev-feedback has-patch needs- | Resolution:
testing | Focuses: template
-------------------------------------------------+-------------------------
Changes (by desrosj):
* keywords: dev-feedback => dev-feedback has-patch needs-testing
Comment:
Thanks for the initial patch @jmichaelward! In [attachment:41564.2.diff],
I added code for single templates and taxonomy archives. I think that if
`taxonomy-tax-name.php` or `single-post-type.php` is searched for, then
`single-post-type-slug.php` should probably should be searched for as
well.
I had a few suggestions for changes in your patch that I made in the new
patch and wanted to share them.
`if ( strpos() )` could result in undesired behaviors, as 0 (first
position in a string) would be considered falsy (`_my_post_type`, for
example) `false !== strpos()` is a better check.
Also, instead of having to use `array_unshift()`, adding the value new
before the current one is better.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41564#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list