[wp-trac] [WordPress Trac] #41152: New Function to Require a file
WordPress Trac
noreply at wordpress.org
Sun Jun 25 09:24:38 UTC 2017
#41152: New Function to Require a file
-------------------------------------+------------------------------
Reporter: rinkuyadav999 | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version:
Severity: normal | Resolution:
Keywords: close reporter-feedback | Focuses:
-------------------------------------+------------------------------
Changes (by swissspidy):
* keywords: close dev-feedback => close reporter-feedback
Comment:
`absint()` is not a great example because it's often used as a callback
for things like `array_map( 'absint', $numbers )`.
Looking at the example code, I don't think we need (yet another) a
function to require a file in a theme. We have `get_template_part()`
(which does a bit more than just a `require`). You can use `require
get_template_directory() . '/file.php';`. You can also use `require
dirname( __FILE__ ) . '/file.php;`.
Looking at the example code, this wouldn't allow me to do something like
`require wp_require_parent_theme_file( 'file.php' );` because the function
can return `null`. That doesn't seem user-friendly to me.
----
@rinkuyadav999 Since you opened the ticket, can you perhaps show a few
examples where such a function might be really useful? For example, would
the default themes greatly benefit from something like that?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41152#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list