10 Juli 2012 - WordPress 3.4.1
Jawaban sebelumnya tidak berfungsi dan seperti yang dikatakan Rarst dalam komentar:
tema-tema yang terkait dengan internal mengalami refactoring besar dan perubahan API di 3.4, jadi banyak hal yang lebih tua tidak akan berfungsi
Solusi jQuery Cepat dan Kotor
add_action('admin_head', 'wpse_13671_script_enqueuer');
function wpse_13671_script_enqueuer() {
global $current_screen;
/**
* /wp-admin/edit.php?post_type=page
*/
if('edit-page' == $current_screen->id)
{
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
$("a.editinline").live("click", function () {
var ilc_qe_id = inlineEditPost.getId(this);
setTimeout(function() {
$('#edit-'+ilc_qe_id+' select[name="page_template"] option[value="showcase.php"]').remove();
}, 100);
});
$('#doaction, #doaction2').live("click", function () {
setTimeout(function() {
$('#bulk-edit select[name="page_template"] option[value="showcase.php"]').remove();
}, 100);
});
});
</script>
<?php
}
/**
* /wp-admin/post.php?post=21&action=edit
*/
if( 'page' == $current_screen->id )
{
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
$('#page_template option[value="showcase.php"]').remove();
});
</script>
<?php
}
}
Tidak Ada Kait untuk Itu?
Jika saya mengikuti jalur yang benar, ini adalah "aksi" yang terjadi ( /wp-includes/class-wp-theme.php
), dan sepertinya tidak ada yang menghubungkan ...
/**
* Returns the theme's page templates.
*
* @since 3.4.0
* @access public
*
* @return array Array of page templates, keyed by filename, with the value of the translated header name.
*/
public function get_page_templates() {
// If you screw up your current theme and we invalidate your parent, most things still work. Let it slide.
if ( $this->errors() && $this->errors()->get_error_codes() !== array( 'theme_parent_invalid' ) )
return array();
$page_templates = $this->cache_get( 'page_templates' );
if ( ! is_array( $page_templates ) ) {
$page_templates = array();
$files = (array) $this->get_files( 'php', 1 );
foreach ( $files as $file => $full_path ) {
$headers = get_file_data( $full_path, array( 'Template Name' => 'Template Name' ) );
if ( empty( $headers['Template Name'] ) )
continue;
$page_templates[ $file ] = $headers['Template Name'];
}
$this->cache_add( 'page_templates', $page_templates );
}
if ( $this->load_textdomain() ) {
foreach ( $page_templates as &$page_template ) {
$page_template = $this->translate_header( 'Template Name', $page_template );
}
}
if ( $this->parent() )
$page_templates += $this->parent()->get_page_templates();
return $page_templates;
}