diff --git src/wp-includes/class-wp-theme.php src/wp-includes/class-wp-theme.php
index 8b3661a..0053fe9 100644
|
|
|
final class WP_Theme implements ArrayAccess {
|
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | $types = array( 'page' ); |
| 1036 | | if ( preg_match( '|Template Post Type:(.*)$|mi', file_get_contents( $full_path ), $type ) ) { |
| | 1036 | if ( preg_match( '|Template Post Type:(.*)\.?\s*$|miU', file_get_contents( $full_path ), $type ) ) { |
| 1037 | 1037 | $types = explode( ',', _cleanup_header_comment( $type[1] ) ); |
| 1038 | 1038 | } |
| 1039 | 1039 | |
diff --git tests/phpunit/data/themedir1/page-templates/38766/no-trailing-period-post-types.php tests/phpunit/data/themedir1/page-templates/38766/no-trailing-period-post-types.php
new file mode 100644
index 0000000..2b68671
|
-
|
+
|
|
| | 1 | <?php |
| | 2 | /* |
| | 3 | Template Name: No Trailing Period |
| | 4 | Template Post Type: period, full-stop |
| | 5 | */ |
diff --git tests/phpunit/data/themedir1/page-templates/38766/trailing-period-post-types.php tests/phpunit/data/themedir1/page-templates/38766/trailing-period-post-types.php
new file mode 100644
index 0000000..594b677
|
-
|
+
|
|
| | 1 | <?php |
| | 2 | /* |
| | 3 | Template Name: Trailing Period. |
| | 4 | Template Post Type: period, full-stop. |
| | 5 | |
| | 6 | Text following the meaningful line to the modifier behaves as expected. |
| | 7 | */ |
diff --git tests/phpunit/tests/admin/includesTheme.php tests/phpunit/tests/admin/includesTheme.php
index 5319006..6a11a7a 100644
|
|
|
class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
| | 90 | * @ticket 38766 |
| | 91 | */ |
| | 92 | function test_page_templates_for_post_types_with_trailing_periods() { |
| | 93 | $theme = wp_get_theme( 'page-templates' ); |
| | 94 | $this->assertNotEmpty( $theme ); |
| | 95 | |
| | 96 | switch_theme( $theme['Template'], $theme['Stylesheet'] ); |
| | 97 | |
| | 98 | $this->assertEqualSetsWithIndex( array( |
| | 99 | 'No Trailing Period' => '38766/no-trailing-period-post-types.php', |
| | 100 | 'Trailing Period.' => '38766/trailing-period-post-types.php', |
| | 101 | ), get_page_templates( null, 'period' ) ); |
| | 102 | $this->assertEqualSetsWithIndex( array( |
| | 103 | 'No Trailing Period' => '38766/no-trailing-period-post-types.php', |
| | 104 | 'Trailing Period.' => '38766/trailing-period-post-types.php', |
| | 105 | ), get_page_templates( null, 'full-stop' ) ); |
| | 106 | } |
| | 107 | |
| | 108 | /** |
| 90 | 109 | * @ticket 38696 |
| 91 | 110 | */ |
| 92 | 111 | function test_page_templates_child_theme() { |