mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 07:07:04 +00:00
Rename the new page_templates filter to theme_page_templates, and pass it a post object for proper context.
see #13265. git-svn-id: https://develop.svn.wordpress.org/trunk@27470 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -705,7 +705,7 @@ function page_attributes_meta_box($post) {
|
||||
<?php
|
||||
} // end empty pages check
|
||||
} // end hierarchical check.
|
||||
if ( 'page' == $post->post_type && 0 != count( get_page_templates() ) ) {
|
||||
if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) ) {
|
||||
$template = !empty($post->page_template) ? $post->page_template : false;
|
||||
?>
|
||||
<p><strong><?php _e('Template') ?></strong></p>
|
||||
|
||||
@@ -741,7 +741,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
|
||||
* @param string $default Optional. The template file name. Default empty.
|
||||
*/
|
||||
function page_template_dropdown( $default = '' ) {
|
||||
$templates = get_page_templates();
|
||||
$templates = get_page_templates( get_post() );
|
||||
ksort( $templates );
|
||||
foreach ( array_keys( $templates ) as $template ) {
|
||||
$selected = selected( $default, $templates[ $template ], false );
|
||||
|
||||
@@ -78,10 +78,11 @@ function delete_theme($stylesheet, $redirect = '') {
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @param WP_Post|null $post Optional. The post being edited, provided for context.
|
||||
* @return array Key is the template name, value is the filename of the template
|
||||
*/
|
||||
function get_page_templates() {
|
||||
return array_flip( wp_get_theme()->get_page_templates() );
|
||||
function get_page_templates( $post = null ) {
|
||||
return array_flip( wp_get_theme()->get_page_templates( $post ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user