Commit Graph

83 Commits

Author SHA1 Message Date
Felix Arntz
59e8596941 Themes: Deprecate usage of TEMPLATEPATH and STYLESHEETPATH constants.
While generally the functions `get_template_directory()` and `get_stylesheet_directory()` were long recommended to use to get the parent or child theme directory, the `TEMPLATEPATH` and `STYLESHEETPATH` constants were still used in a few places in core, most importantly in template related logic.

The remaining usage was problematic as it prevented testability of certain key components of WordPress core.

This changeset replaces all remaining usage with the corresponding functions and effectively marks these constants as deprecated. It also adds test coverage accordingly and even unlocks some existing, previously commented out test coverage to work as expected.

Performance of the new approach has been benchmarked and shows no notable differences. Yet, given that the current theme directories are not expected to change within a regular WordPress page load, the `get_template_directory()` and `get_stylesheet_directory()` functions were amended with in-memory caching of the result, unless one of the defining values is being filtered.

Props thekt12, spacedmonkey, mukesh27, aaroncampbell, scribu, lloydbudd, cais, chipbennett, toscho, omarabid, CrazyJaco, DrewAPicture, obenland, wonderboymusic, nacin, helen, dd32, chriscct7, SergeyBiryukov, swissspidy, joemcgill, flixos90.
Fixes #18298.

Built from https://develop.svn.wordpress.org/trunk@56635


git-svn-id: http://core.svn.wordpress.org/trunk@56147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 17:27:23 +00:00
Felix Arntz
7c7f95a8b2 Themes: Avoid unnecessary check whether parent template file exists when not using a child theme.
Prior to this change, the `locate_template()` function would unconditionally check whether the relevant template file exists in the parent theme, which for sites not using a child theme is an exact duplicate of the previous check. This is wasteful and has a small impact on performance since `file_exists()` checks have a cost.

Props nihar007, thekt12, spacedmonkey, mukesh27.
Fixes #58576.

Built from https://develop.svn.wordpress.org/trunk@56357


git-svn-id: http://core.svn.wordpress.org/trunk@55869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 20:31:22 +00:00
audrasjb
b89f155a10 Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178], [56179], [56180], [56191], [56192], [56193].

Props costdev, audrasjb.
See #58459.



Built from https://develop.svn.wordpress.org/trunk@56194


git-svn-id: http://core.svn.wordpress.org/trunk@55706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-10 23:11:22 +00:00
Sergey Biryukov
1ce5dc7444 Code Modernization: Replace usage of strpos() with str_contains().
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].

Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #58206.
Built from https://develop.svn.wordpress.org/trunk@55988


git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:36:26 +00:00
Sergey Biryukov
bdfe3d5a46 Coding Standards: Use strict comparison where count() is involved.
Follow-up to [1636], [6974], [8114], [10322], [13326], [14760], [18006], [18541], [19743], [23249], [24115], [33359].

Props aristath, poena, afercia, SergeyBiryukov.
See #57839.
Built from https://develop.svn.wordpress.org/trunk@55642


git-svn-id: http://core.svn.wordpress.org/trunk@55154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-10 12:56:21 +00:00
Sergey Biryukov
bf344bb3bf Code Modernization: Rename parameters that use reserved keywords in wp-includes/template.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$require_once` parameter to `$load_once` in:
* `locate_template()`
* `load_template()`

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55013


git-svn-id: http://core.svn.wordpress.org/trunk@54546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-22 11:08:19 +00:00
Sergey Biryukov
97468065ef Docs: Add brackets to a function name in get_page_template() description.
This ensures the `locate_block_template()` function name is correctly linked in the Developer Reference.

Follow-up to [54179].

See #56792.
Built from https://develop.svn.wordpress.org/trunk@54747


git-svn-id: http://core.svn.wordpress.org/trunk@54299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-02 19:52:18 +00:00
Peter Wilson
a0cefe8a20 Themes: Relocate actions firing prior to and after template loading.
This relocates the actions `wp_before_load_template` and `wp_after_load_template` to fire within the `load_template()` function.

Prior to this change the actions fired in the `locate_template()` function.

Follow up to [53560].

Props johnjamesjacoby, johnbillion.
Fixes #54541.


Built from https://develop.svn.wordpress.org/trunk@54270


git-svn-id: http://core.svn.wordpress.org/trunk@53829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 01:09:10 +00:00
audrasjb
82c08816f6 Docs: Use third-person singular verbs in Template Loading functions descriptions, as per docblocks standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@54180


git-svn-id: http://core.svn.wordpress.org/trunk@53739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 12:49:08 +00:00
audrasjb
199454f6ae Docs: Clarify that get_page_template() doesn't work on block themes.
When working on a block theme, `locate_block_template()` should be used instead of `get_page_template()`. This changeset updates the docblock of this function accordingly.

Props audrasjb, costdev, robinwpdeveloper.
Fixes #56394.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@54179


git-svn-id: http://core.svn.wordpress.org/trunk@53738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 12:44:09 +00:00
John Blackbourn
5dd1936fdb Themes: Add actions to template loading to assist with collecting debug info.
This introduces the following new actions which wrap the process of loading a template file:

* `wp_before_load_template`
* `wp_after_load_template`

Props rmccue, tabrisrp, peterwilsoncc

Fixes #54541

Built from https://develop.svn.wordpress.org/trunk@53560


git-svn-id: http://core.svn.wordpress.org/trunk@53149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 18:59:09 +00:00
youknowriad
4ae0e4220f Block Editor: Introduce block templates for classic themes.
With this patch, users will be able to create custom block based templates
and assign them to specific pages/posts.

Themes can also opt-out of this feature

Props bernhard-reiter, carlomanf.
Fixes #53176.

Built from https://develop.svn.wordpress.org/trunk@51003


git-svn-id: http://core.svn.wordpress.org/trunk@50612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 14:20:57 +00:00
John Blackbourn
52679edbff Docs: Add examples of possible names for various hooks whose name contains a dynamic portion.
This provides greater discoverability of such hooks in search results on the Code Reference site as well as increased clarity when reading the source.

See #50734, #52628

Built from https://develop.svn.wordpress.org/trunk@50505


git-svn-id: http://core.svn.wordpress.org/trunk@50118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-07 12:32:09 +00:00
Sergey Biryukov
4518255c93 Themes: Allow template loading functions to pass additional arguments to the template via the $args parameter.
This affects:
* `get_header()`
* `get_footer()`
* `get_sidebar()`
* `get_template_part()`
* `locate_template()`
* `load_template()`

Note: `get_search_form()` already passes additional arguments to the template as of [44956].

Props enrico.sorcinelli, sc0ttkclark, scribu, nacin, wonderboymusic, GeertDD, beatpanda, amaschas, mintindeed, ysalame, caiocrcosta, bigdawggi, julianm, eddiemoya, shawnz, sayedwp, shamai, mboynes, mihai2u, guidobras, Mte90, apedog, stuffradio, overclokk, johnbillion, joyously, afercia, audrasjb, justlevine, SergeyBiryukov.
See #21676.
Built from https://develop.svn.wordpress.org/trunk@48370


git-svn-id: http://core.svn.wordpress.org/trunk@48139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 11:01:59 +00:00
Sergey Biryukov
7932193708 Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47808


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Sergey Biryukov
47ed56f38f Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov
d2a48496d2 Docs: Add missing description for $comment global.
Props immeet94, mukesh27.
Fixes #46928. See #47110.
Built from https://develop.svn.wordpress.org/trunk@46391


git-svn-id: http://core.svn.wordpress.org/trunk@46190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-04 22:19:57 +00:00
Sergey Biryukov
9967a3e030 Docs: Add missing description for $post global.
Props immeet94.
Fixes #46503. See #47110.
Built from https://develop.svn.wordpress.org/trunk@45742


git-svn-id: http://core.svn.wordpress.org/trunk@45553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 12:28:56 +00:00
Sergey Biryukov
7f7480cb2a Docs: Add missing description for $wp_query and $wp_the_query globals.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45739


git-svn-id: http://core.svn.wordpress.org/trunk@45550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:59:56 +00:00
Sergey Biryukov
ea606165a5 Docs: Add missing description for $wp global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45736


git-svn-id: http://core.svn.wordpress.org/trunk@45547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:28:55 +00:00
Sergey Biryukov
b1e34ccc1f Docs: Add missing description for $wp_rewrite global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45735


git-svn-id: http://core.svn.wordpress.org/trunk@45546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:19:56 +00:00
Sergey Biryukov
29b072e706 Docs: Add missing description for $wpdb, $wp_db_version, and $wp_current_db_version globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +00:00
Sergey Biryukov
c9efbc89be Docs: Correct @return description for get_privacy_policy_template().
Props tmatsuur.
Fixes #46989. See #44005.
Built from https://develop.svn.wordpress.org/trunk@45251


git-svn-id: http://core.svn.wordpress.org/trunk@45060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-19 13:46:51 +00:00
Sergey Biryukov
e1de58320d Themes: Standardize on passing frontpage and privacypolicy as the $type parameter to get_query_template().
These keys are used in `{$type}_template_hierarchy` and `{$type}_template` filters.

Previously, `front_page` and `privacy_policy` were passed, but `get_query_template()` stripped the underscores before passing the values to the filters.

Props rinatkhaziev, tmatsuur, johnbillion.
Fixes #21213, #46958.
Built from https://develop.svn.wordpress.org/trunk@45231


git-svn-id: http://core.svn.wordpress.org/trunk@45040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-17 12:58:51 +00:00
Sergey Biryukov
7d74080b80 Privacy: Introduce Privacy Policy page helpers:
* `is_privacy_policy()` template tag
* `privacy-policy.php` template
* `.privacy-policy` body class
* `.menu-item-privacy-policy` menu item class

Props garrett-eclipse, birgire, xkon, Clorith.
Fixes #44005.
Built from https://develop.svn.wordpress.org/trunk@44966


git-svn-id: http://core.svn.wordpress.org/trunk@44797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 19:48:50 +00:00
Gary Pendergast
08e8270a48 Coding Standards: Extract extract() from the codebase.
Of the last four instances of `extract()` occurring, three of them are removed by this commit, and the fourth is appropriately documented.

See #45934.


Built from https://develop.svn.wordpress.org/trunk@44569


git-svn-id: http://core.svn.wordpress.org/trunk@44400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-12 03:20:48 +00:00
John Blackbourn
91464bce65 Docs: Add missing code formatting to various @since entries.
See #42505

Built from https://develop.svn.wordpress.org/trunk@42678


git-svn-id: http://core.svn.wordpress.org/trunk@42506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-09 16:55:31 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Drew Jaynes
1fb8cbe8de Docs: Don't reference non-existent hooks inline in the DocBlock descriptions for the following template functions:
* `get_index_template()`
* `get_404_template()`
* `get_author_template()`
* `get_category_template()`
* `get_tag_template()`
* `get_taxonomy_template()`
* `get_date_template()`
* `get_home_template()`
* `get_front_page_template()`
* `get_page_template()`
* `get_search_template()`
* `get_single_template()`
* `get_embed_template()`
* `get_singular_template()`
* `get_attachment_template()`

As mentioned when these dynamic hook references were originally fixed in [33274], we can't link to non-existent hooks inline because the Code Reference auto-linker won't pick up on the dynamic-ness of the hook, it'll just try to link to a hook reference that doesn't exist. In these cases, we need to be generic and provide context for the value of `$type`.

See [38418] for where the original fix was reversed. See this changeset for reversing the reversal.

Props donutz, milana_cap.

Fixes #41198.

Built from https://develop.svn.wordpress.org/trunk@40964


git-svn-id: http://core.svn.wordpress.org/trunk@40814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-29 16:05:41 +00:00
Drew Jaynes
8ccc74c054 Docs: Don't reference non-existent hooks inline in the DocBlock description for get_archive_template().
Also removes extra curly braces from the dynamic hook references added in [40962] to aid future re-parsing.

See #41198.

Built from https://develop.svn.wordpress.org/trunk@40963


git-svn-id: http://core.svn.wordpress.org/trunk@40813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-29 15:47:40 +00:00
Drew Jaynes
1e32ebe87d Docs: Don't reference non-existent hooks inline in the DocBlock description for get_post_type_archive_template().
Props milana_cap.
See #41198.

Built from https://develop.svn.wordpress.org/trunk@40962


git-svn-id: http://core.svn.wordpress.org/trunk@40812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-29 15:39:40 +00:00
Sergey Biryukov
678b53cb45 Docs: Add missing opening quote for 'home' in {$type}_template_hierarchy and {$type}_template filters documentation.
Props tmatsuur, truongwp.
Fixes #40962.
Built from https://develop.svn.wordpress.org/trunk@40894


git-svn-id: http://core.svn.wordpress.org/trunk@40744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-10 22:48:44 +00:00
John Blackbourn
1100cca947 Themes: Add template type and template candidates as parameters to the {$type}_template filter.
Props mschadegg
Fixes #39525

Built from https://develop.svn.wordpress.org/trunk@40057


git-svn-id: http://core.svn.wordpress.org/trunk@39994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-12 21:25:42 +00:00
Boone Gorges
e836e47a8a Avoid PHP notices in get_post_type_archive_template().
The function should fail more gracefully when called in the context
where `get_query_var( 'post_type' )` doesn't represent an actual post
type.

Props technopolitica, dlh.
Fixes #38374.
Built from https://develop.svn.wordpress.org/trunk@40031


git-svn-id: http://core.svn.wordpress.org/trunk@39968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-30 19:32:42 +00:00
Sergey Biryukov
32564f9332 Themes: Use curly braces for variables inside strings in `get_page_template() to explicitly specify the end of the variable name.
Props kuck1u.
Fixes #38625.
Built from https://develop.svn.wordpress.org/trunk@39884


git-svn-id: http://core.svn.wordpress.org/trunk@39821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-12 04:13:42 +00:00
Pascal Birchler
81a26f6900 Posts, Post Types: Add support for post type templates.
WordPress has supported custom page templates for over 12 years, allowing developers to create various layouts for specific pages.
While this feature is very helpful, it has always been limited to the 'page' post type and not was not available to other post types.

By opening up the page template functionality to all post types, we continue to improve the template hierarchy's flexibility.

In addition to the `Template Name` file header, the post types supported by a template can be specified using `Template Post Type: post, foo, bar`.
When at least one template exists for a post type, the 'Post Attributes' meta box will be displayed in the back end, without the need to add post type support for `'page-attributes'`. 'Post Attributes' can be customized per post type using the `'attributes'` label when registering a post type.

Props johnbillion, Mte90, dipesh.kakadiya, swissspidy.
Fixes #18375.
Built from https://develop.svn.wordpress.org/trunk@38951


git-svn-id: http://core.svn.wordpress.org/trunk@38894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 08:07:30 +00:00
John Blackbourn
afff60c378 Themes: Improve the inline documentation for the get_*_template() functions by providing examples instead of verbose explanations.
Fixes #38249
See #37770

Built from https://develop.svn.wordpress.org/trunk@38789


git-svn-id: http://core.svn.wordpress.org/trunk@38732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-14 14:20:29 +00:00
John Blackbourn
c0f1a49575 Themes: Remove paged.php from the theme template hierarchy.
The position of this template within the hierarchy is of so little use that zero themes in the WordPress.org theme directory make use of it. It's second only to `index.php` in the hierarchy, meaning that any archive template such as `category.php` or `archive.php` will be chosen before it.

Fixes #38162
Props ryankienstra for initial patch

Built from https://develop.svn.wordpress.org/trunk@38755


git-svn-id: http://core.svn.wordpress.org/trunk@38698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-07 21:03:31 +00:00
Sergey Biryukov
f348f9a59c Docs: Use a third-person singular verb for {$type}_template_hierarchy filter added in [38385].
See #14310.
Built from https://develop.svn.wordpress.org/trunk@38609


git-svn-id: http://core.svn.wordpress.org/trunk@38552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-14 21:54:30 +00:00
John Blackbourn
e482549183 Themes: Add the non-encoded form of the queried item slug to the template hierarchy when the slug contains non-ASCII characters.
This affects category, tag, and custom taxonomy archives, and single posts, pages, and custom post types.

Fixes #37655

Built from https://develop.svn.wordpress.org/trunk@38583


git-svn-id: http://core.svn.wordpress.org/trunk@38526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-09 00:48:28 +00:00
John Blackbourn
b3faafc632 Themes: Correct the list of possible values for the dynamic portion of the {$type}_template_hierarchy and {$type}_template filters.
See #14310

Built from https://develop.svn.wordpress.org/trunk@38428


git-svn-id: http://core.svn.wordpress.org/trunk@38369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-28 23:57:49 +00:00
John Blackbourn
d346835bfb Themes: Update filter names in the inline documentation for the get_*_template() functions.
See #14310, #37770

Built from https://develop.svn.wordpress.org/trunk@38418


git-svn-id: http://core.svn.wordpress.org/trunk@38359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-28 16:15:30 +00:00
John Blackbourn
9e1542b9ec Themes: Make the template hierarchy for a given template type filterable.
This introduces a `{$type}_template_hierarchy` filter that allows the hierarchy of candidate template filenames for a given template type to be filtered.

This allows the hierarchy to be added to or altered completely without resorting to re-building the hierarchy from scratch within the `template_include` filter, which is common and prone to conflicts between plugins and prone to getting out of sync with core's hierarchy.

Fixes #14310

Built from https://develop.svn.wordpress.org/trunk@38385


git-svn-id: http://core.svn.wordpress.org/trunk@38326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 21:03:27 +00:00
Drew Jaynes
9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37518


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Drew Jaynes
f52a8cb1fa Docs: Remove/replace invalid inline @link tags in DocBlocks in wp-includes/*.
Fixes #36910.

Built from https://develop.svn.wordpress.org/trunk@37487


git-svn-id: http://core.svn.wordpress.org/trunk@37455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:39:28 +00:00
Drew Jaynes
2e0866bcbc Docs: Correct a typo in the DocBlock summary for get_embed_template(), introduced in [36963].
Props swissspidy.
See #34561, #34278. See #35986.

Built from https://develop.svn.wordpress.org/trunk@36965


git-svn-id: http://core.svn.wordpress.org/trunk@36933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 22:45:26 +00:00
Drew Jaynes
b533878fa2 Docs: Use a third-person singular verb in the summary for get_embed_template(), introduced in [36876].
See #34561, #34278. See #35986.

Built from https://develop.svn.wordpress.org/trunk@36963


git-svn-id: http://core.svn.wordpress.org/trunk@36931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 22:09:26 +00:00
Pascal Birchler
dc2f39b7f0 Embeds: Add support for embeds in the theme template hierarchy.
This allows themes to directly override the default template. The order in which the template is retrieved is as follows: `embed-$post_type-$post_format.php` -> `embed-$post_type.php` -> `embed.php`.

The `embed_template` filter gets replaced by the dynamic `{$type}_template` filter in `get_query_template()`.

Props ChriCo, swissspidy.
See #34561. Fixes #34278.
Built from https://develop.svn.wordpress.org/trunk@36876


git-svn-id: http://core.svn.wordpress.org/trunk@36843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-07 19:33:26 +00:00
Drew Jaynes
0fc00feec3 Embeds: Introduce embed templates into the template hierarchy via theme-compat.
Splits wp-includes/embed-template.php, introduced in 4.4, into five new templates that can be individually overridden by themes:

* embed.php
* embed-404.php
* embed-content.php
* header-embed.php
* footer-embed.php

Also introduces a new template tag for outputting the site title, `the_embed_site_title()`.

The five new templates live in theme-compat, allowing for graceful fallbacks should themes prefer not to override any or all of them.

Props swissspidy, imath, ocean90, DrewAPicture.
See #34561.

Built from https://develop.svn.wordpress.org/trunk@36693


git-svn-id: http://core.svn.wordpress.org/trunk@36660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 20:57:26 +00:00