Making WordPress.org

Changeset 10857


Ignore:
Timestamp:
03/29/2021 06:37:17 AM (4 years ago)
Author:
dd32
Message:

Theme Directory: Tell WordPress to use index.php as the template for archive & singular views.

This is required as the theme is now marked as a child theme of wporg, and WordPress will fall back to it's templates if it doesn't exist in the child theme.
The Theme Directory being a special theme, most views simply aren't defined as it's intended that the index.php template would have been the fallback for them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php

    r10742 r10857  
    559559    return $schema;
    560560}
     561
     562/**
     563 * Use the index.php template for various WordPress views that would otherwise be handled by the parent theme.
     564 */
     565function use_index_php_as_template() {
     566    return __DIR__ . '/index.php';
     567}
     568add_filter( 'single_template',  'use_index_php_as_template' );
     569add_filter( 'archive_template', 'use_index_php_as_template' );
Note: See TracChangeset for help on using the changeset viewer.