WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#12635 closed defect (bug) (fixed)

template-loader does not check for child theme's index.php

Reported by: koopersmith Owned by: nacin
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords:
Focuses: Cc:
PR Number:

Description

When template-loader reaches the last case in the if statement, it checks for only the parent theme's index.php. Template-loader should first check for the child's index.php, then the parent's index.php. It should use locate_template, which will check for both the parent and the child and behave accordingly.

To replicate the bug, make a parent and child theme each with only index.php. In no instances should the parent's index.php be shown, but on archive pages (and others) it will appear.

For easier bug replication:

  1. Make a child theme of twentyten with a blank index.php
  2. Delete twentyten's archive.php
  3. Navigate to an archive page

Attachments (2)

template-loader.patch (734 bytes) - added by koopersmith 10 years ago.
12635.2.patch (1.2 KB) - added by koopersmith 10 years ago.
Introduce get_index_template()

Download all attachments as: .zip

Change History (5)

#1 @nacin
10 years ago

Interesting thought. Should probably introduce get_index_template() which returns get_query_template('index').

@koopersmith
10 years ago

Introduce get_index_template()

#2 @nacin
10 years ago

  • Milestone changed from Unassigned to 3.0
  • Owner set to nacin
  • Status changed from new to reviewing

#3 @nacin
10 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

(In [13819]) Introduce get_index_template(). Allows child themes to override a parent theme's index.php. Props koopersmith, fixes #12635

Note: See TracTickets for help on using tickets.