Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12635 closed defect (bug) (fixed)

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

Reported by: koopersmith's profile koopersmith Owned by: nacin's profile nacin
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords:
Focuses: Cc:

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 15 years ago.
12635.2.patch (1.2 KB) - added by koopersmith 15 years ago.
Introduce get_index_template()

Download all attachments as: .zip

Change History (5)

#1 @nacin
15 years ago

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

@koopersmith
15 years ago

Introduce get_index_template()

#2 @nacin
15 years ago

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

#3 @nacin
15 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.