#27201 closed defect (bug) (fixed)
Any file called index.php is labeled as Main Index Template by theme editor, even if it is not the main index template.
Reported by: | Shelob9 | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 1.5 |
Component: | Themes | Keywords: | has-patch theme-editor |
Focuses: | administration | Cc: |
Description
In the theme editor, any file called index.php is labeled as 'Main Index Template' even if it is in a subdirectory of the theme and is not actually the main index template for the theme.
Attachments (9)
Change History (26)
#3
@
11 years ago
Please use tabs rather than spaces for indentation (per WordPress Coding Standards).
#4
@
11 years ago
Not just index.php , any standard WP theme descriptive file of $wp_file_descriptions .
#7
@
11 years ago
27201.4.diff removes the return ""; so that at the end of the function it returns the default and consistent filename rather than an empty string. Also converted spaces to tabs and some other minor clean up.
#9
@
11 years ago
- Keywords needs-patch added; has-patch removed
First, we prefer to use "yoda conditions" so it should be 'themes' == basename( dirname( dirname( $file ) ) )
Having said that though, we can't actually compare to 'themes' because you can specify a custom themes directory using register_theme_directory()
. Take a look at get_theme_root()
and get_raw_theme_root()
to see what I'm talking about. They fall back to WP_CONTENT_DIR/themes/
but they allow for something custom first.
#10
@
11 years ago
- Milestone changed from 3.9 to Future Release
Since this patch isn't ready, we're already in Beta, and this isn't critical or new, I'm going to move it out of the 3.9 milestone.
This ticket was mentioned in IRC in #wordpress-dev by AaronCampbell. View the logs.
11 years ago
#12
@
11 years ago
A different approach to get file description by passing relative path and comparing using pathinfo() as whether the files are in the base level or not.
And implementing brace-style standards.
I have attached two patches for this issue. 27201.diff fixes the issue by labeling any file called index.php that is not the main index template with its path and file name. So, for example, 'inc/index.php' will be labeled as 'inc/index.php'. This is a nice easy solution, but not the greatest. There must be a better way to label these index files, I just don't know what.
27201.2.diff does the same thing, and also adds braces to the two conditionals in the same section of the file, as is called for by WordPress coding standards. It seemed odd to have it right for one conditional, but wrong for the two right before it, but I was worried about the patch exceeding the scope of the issue, so I made two patches.