I’m using the TwentyTen theme to create a child theme, but I can’t seem to get rid of the ‘One column, no sidebar’ page template that is in the TwentyTen parent theme.
I thought just copying it over and deleting the contents would do the trick, but it seems not. Does anyone know how to do this? I’m sure it’s very simple.
Thanks
osu
Overriding that template would be much easier than getting rid of it. Just the way logic goes.
I make no claim it’s efficient idea (late here), but this would get it nuked from edit screen:
WordPress 3.9 introduces a
theme_page_templates
filter.The example below from a Twenty Fourteen child theme
functions.php
shows how to remove the “Contributor Page” template:Expanding on @Rarst’s answer, here’s a more generic approach that is not tied to a specific theme, but can be used inside your own child theme’s functions.php to nuke any parent theme page templates you want to get rid of.
So you can use it in your child theme’s functions.php file like so:
Here I’m just illustrating that you don’t have to pass the “.php” part if you don’t want to.
Or:
remove_template( "sidebar-page" );
– you don’t need to pass an array if you want to modify only a single file.There’s a new filter in WP core (3.9) to remove page templates. It can be used from child themes.
Here’s how to achieve this in TwentyTen (tested on WP 3.9):
https://core.trac.wordpress.org/changeset/27297
http://boiteaweb.fr/theme_page_templates-hook-semaine-16-8033.html
Since previous answers no longer work here in current versions of WordPress and there was a related question which I just answered (April 2013) using a PHP output buffer I figured I’d post a link to that answer.
Also just published the Omit Parent Theme Page Templates plugin that filters out all parent theme page templates from the dropdown list of templates in the Page Attributes metabox when adding or editing a WordPress “Page.”
July 10, 2012 – WordPress 3.4.1
Previous answers are not working and as Rarst said in a comment:
Quick and Dirty jQuery Solution
No Hook for That?
If I followed the correct path, this is where the “action” happens (
/wp-includes/class-wp-theme.php
), and looks like there’s nothing here to hook on…