[wp-trac] [WordPress Trac] #41152: New Function to Require a file
WordPress Trac
noreply at wordpress.org
Sun Jun 25 09:46:59 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:
-------------------------------------+------------------------------
Comment (by rinkuyadav999):
Hi @swissspidy
Right now theme developer needs to use php require and file path. like
`require get_template_directory() . '/file.php';` OR `require
get_parent_theme_file_path( '/inc/icon-functions.php' );`
It will better, WordPress provide us a function to just add location of
file inside a function and it will require. This is to include part of
functions.php file. `get_template_part()` used to add part of a theme file
like `get_template_part( 'template-parts/post/content', get_post_format()
);`
`get_parent_theme_file_path` function do almost same task but it does not
require passed file instead it return proper path of file.
PS: i am expecting a function like `wp_require_theme_file( '/inc/icon-
functions.php' );` and it will do `require get_template_directory() .
'/inc/icon-functions.php';`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41152#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list