Commit Graph

80 Commits

Author SHA1 Message Date
Sergey Biryukov 3792591dfb Add `single-{post_type}-{post_name}.php` to the top of the template hierarchy for single posts.
This is consistent with page and taxonomy templates, which support slugs as well.

Props ericjuden, johnbillion.
Fixes #18859.
Built from https://develop.svn.wordpress.org/trunk@34800


git-svn-id: http://core.svn.wordpress.org/trunk@34765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-03 15:00:25 +00:00
Drew Jaynes cf7e13813f Docs: Update the DocBlock descriptions for a variety of template functions to better reflect that the dynamic `$type_template` hook can be used to filter the template path.
It's important to reference the actual dynamic hook name instead of an alias for purposes of auto-linking in the Code Reference.

Affects the docs for:
* `get_index_template()`
* `get_404_template()`
* `get_archive_template()`
* `get_post_type_archive_template()`
* `get_author_template()`
* `get_category_template()`
* `get_tag_template()`
* `get_taxonomy_template()`
* `get_date_template()`
* `get_home_template()`
* `get_page_template()`
* `get_paged_template()`
* `get_search_template()`
* `get_single_template()`
* `get_singular_template()`
* `get_attachment_template()`

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 22:27:24 +00:00
Drew Jaynes f7f4a97d07 Docs: Clarify the hook docs for the `{$type}_template` hook to mention that non-alphanumeric characters delimiting words will also be removed from the passed `$type` parameter.
Also remove a now-unnecessary inline `@see` tag from the return description.

See #32246. See #32989.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 22:12:25 +00:00
Drew Jaynes 84419a51b8 Update the descriptions for `get_front_page_template()` and `get_comments_popup_template()` to reference the correct dynamic hook names.
Part props @birgire.

Fixes #32989. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 21:59:25 +00:00
Drew Jaynes 08ad571942 Fix inline documentation syntax in the DocBlock for `get_singular_template()`, added in 4.3.
See [32846]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 21:59:24 +00:00
Aaron Jorbin 4b7ce555d0 Add singular.php to template hierarchy
Singular is the only template context conditional that lacks a corresponding template. This allows some themes to simplify.

Fixes #22314.
Props chipbennett.


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


git-svn-id: http://core.svn.wordpress.org/trunk@32817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-18 19:01:26 +00:00
Scott Taylor a1bd091d65 In `get_attachment_template()`, pass an array of templates to `get_query_template( 'attachment', $templates )`, instead of bailing on the first found template.
Props willnorris, jfarthing84, SergeyBiryukov, DrewAPicture, wonderboymusic.
Fixes #15337.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 20:50:26 +00:00
Scott Taylor 0c1b765a6f Add missing doc blocks to `template.php`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-27 22:04:26 +00:00
Andrew Nacin 5a84e32652 Escape the $s global.
fixes #32142.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-27 05:10:27 +00:00
Scott Taylor fe6b5983df In PHP 5.0.0, `is_a()` became deprecated in favour of the `instanceof` operator. Calling `is_a()` would result in an `E_STRICT` warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Scott Taylor 60b0cd7943 The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Drew Jaynes bffe95d34c Docs Formatting: Backtick-escape inline code for all remaining dynamic hook docs in wp-includes/*.
Affects DocBlocks for the following hooks:
* `auth_post_meta_{$meta_key}`
* `term_links-$taxonomy`
* `customize_render_control_ . $this->id`
* `customize_render_panel_{$this->id}`
* `customize_render_section_{$this->id}`
* `customize_preview_{$this->id}`
* `customize_save_ . $this->id_data[ 'base' ]`
* `customize_update_ . $this->type`
* `customize_value_ . $this->id_data[ 'base' ]`
* `customize_sanitize_js_{$this->id}`
* `comment_form_field_{$name}`
* `comment_{$old_status}_to_{$new_status}`
* `comment_{$new_status}_{$comment->comment_type}`
* `extra_{$context}_headers`
* `get_template_part_{$slug}`
* `get_the_generator_{$type}`
* `get_{$adjacent}_post_join`
* `get_{$adjacent}_post_where`
* `get_{$adjacent}_post_sort`
* `{$adjacent}_post_rel_link`
* `{$adjacent}_post_link`
* `{$adjacent}_image_link`
* `blog_option_{$option}`
* `$permastructname . _rewrite_rules`
* `{$type}_template`
* `theme_mod_{$name}`
* `pre_set_theme_mod_$name`
* `current_theme_supports-{$feature}`
* `get_user_option_{$option}`
* `edit_user_{$field}`
* `pre_user_{$field}`
* `user_{$field}`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 12:10:23 +00:00
Scott Taylor ef436cb6e0 Revert [28563]. See #18298.
Built from https://develop.svn.wordpress.org/trunk@29044


git-svn-id: http://core.svn.wordpress.org/trunk@28832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 18:07:16 +00:00
Scott Taylor b75c79500b Replaces all uses of `TEMPLATEPATH` and `STYLESHEETPATH` in core with `get_template_directory()` and `get_stylesheet_directory()`.
Add `@deprecated` annotations to `TEMPLATEPATH` and `STYLESHEETPATH` definitions.

Props obenland, aaroncampbell. 
Fixes #18298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-23 20:12:15 +00:00
Drew Jaynes 95bb449a4d Inline documentation improvements for get_*_template() functions in wp-includes/template.php.
* Adds `@see` references for `get_query_template()` or similar
* Adds complete `@return` descriptions
* Clarifies which dynamic hooks can be used to filter specific template types

Props UmeshSingla for the initial patches. Props SergeyBiryukov, DrewAPicture.
Fixes #26742.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-05 17:55:11 +00:00
Andrew Nacin d0cfa40983 Add jshintrc to qunit.
props jorbin.
see #25187.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-30 14:39:10 +00:00
Drew Jaynes a8bce2a54d Inline documentation for a hooks in wp-includes/template.php.
Props jonlynch for the initial patch.
Fixes #25487.
Built from https://develop.svn.wordpress.org/trunk@25703


git-svn-id: http://core.svn.wordpress.org/trunk@25618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-06 19:01:09 +00:00
Scott Taylor 71430cd29a Add sanity checks to `get_*_template()` functions to ensure that the return value of `get_queried_object()` is compatible with the assumed context.
Fixes #25291.
See #25282.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 05:32:10 +00:00
Scott Taylor 8bd9659d0d Move checks for `post_type` being an array inline. See [25291], [25292], #18614.
Built from https://develop.svn.wordpress.org/trunk@25312


git-svn-id: http://core.svn.wordpress.org/trunk@25274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 03:02:10 +00:00
Scott Taylor d24a3940de Make sure the queried object is non-null before accessing its properties.
Props markoheijnen, ryan.
Fixes #21394.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 02:28:11 +00:00
Scott Taylor a67d551dac Ensure that the post type object is the queried object when a post type has been registered with `has_archive => true`. Ensure it is not stomped when decorated with `tax_query`. Adds unit tests.
Props nacin.
Fixes #18614.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 22:07:09 +00:00
Sergey Biryukov 763e039b0b Improve punctuation in phpdoc. see #23090.
git-svn-id: http://core.svn.wordpress.org/trunk@23665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-12 09:30:13 +00:00
Helen Hou-Sandí b538d6163f Make sure .widefat border and background coloring only applies to tables. props MikeHansenMe. fixes #21936.
git-svn-id: http://core.svn.wordpress.org/trunk@23315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-22 14:44:04 +00:00
Andrew Nacin ba3036ed75 Ensure that get_archive_template() only loads a post type archive (archive-$post_type.php file) if there is exactly one post type in the query.
props scribu.
see #22956.
for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-03 06:17:47 +00:00
Ryan Boren 06ee370814 Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@22634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-17 15:11:29 +00:00
Ryan Boren 5c713162f1 Avoid notices in get_*_template() functions that use get_queried_object(), which can return null. Props wonderboymusic. fixes #20519
git-svn-id: http://core.svn.wordpress.org/trunk@22293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 12:54:50 +00:00
Andrew Nacin 4c64b3a4b9 Expect a possible array of post types in get_archive_template(). props SergeyBiryukov. fixes #20867.
git-svn-id: http://core.svn.wordpress.org/trunk@21861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 20:07:15 +00:00
nacin 111f59eac5 Remove reference to a global eliminated long ago. props tamlyn, fixes #20668.
git-svn-id: http://core.svn.wordpress.org/trunk@20872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 07:06:13 +00:00
nacin ae8af5d0dd Introduce get_page_template_slug( $id = null ) to return a page's template (like "showcase.php"). Returns false if post ID is not a page, and an empty string for the default page template. Use the function across core. props billerickson for initial patch. fixes #18750.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-02 18:56:54 +00:00
nacin e4bfd6ecc1 Move the template loading functions from wp-includes/theme.php to wp-includes/template.php. This includes get_query_template(), locate_template(), and friends. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 01:49:49 +00:00