Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#21230 closed enhancement (fixed)

Twenty Twelve: Namespace all the things

Reported by: obenland's profile obenland Owned by: lancewillett's profile lancewillett
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

Per the WPTRT guidelines:

Themes are required to use a unique slug as a prefix for anything in the public namespace

I hope I cought it all - if not, this ticket might serve for all namespace related issues.

Attachments (2)

21230.diff (6.0 KB) - added by obenland 13 years ago.
21230.2.diff (1.0 KB) - added by obenland 13 years ago.
Namespace script and style handles

Download all attachments as: .zip

Change History (17)

@obenland
13 years ago

#1 follow-up: @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.5

Technically, templates are not loaded in the public namespace, so the stuff in image.php is not necessary. The functions.php changes look proper. The archive.php changes modify a de facto standard that has found its way into Twenty Eleven and a number of wpcom-themes. (Twenty Ten does not have tag/category descriptions shown in the theme.)

#2 in reply to: ↑ 1 @obenland
13 years ago

Replying to nacin:

The archive.php changes modify a de facto standard that has found its way into Twenty Eleven and a number of wpcom-themes. (Twenty Ten does not have tag/category descriptions shown in the theme.)

So wouldn't now be the perfect time to change that? :)

We have

  • 'twentytwelve_author_bio_avatar_size'
  • 'twentytwelve_attachment_size'
  • 'twentytwelve_default_theme_options'
  • 'twentytwelve_options_validate'
  • even 'twentytwelve_credits'

so prefixing the last two would just make sense.

#3 @lancewillett
13 years ago

  • Cc lancewillett added

#4 follow-up: @nacin
13 years ago

I'm only referring tag_archive_meta and category_archive_meta. 16 different themes in http://wpcom-themes.svn.wordpress.org, including Twenty Eleven, Toolbox, and _s, use these "generic" filters. I'll defer to lancewillett and iandstewart as to whether they have seen this as intentional, or just subconscious copy-paste.

#5 @WraithKenny
13 years ago

A standard could be adopted where the prefix of all the things (variables and hooks introduced by the theme) could be "theme." Justification: It's not like plugins where conflicts can occur as only one theme runs at a time, and its simple and copy/paste friendly. Just an idea. I'm not sure if or how many core function/variable/hooks use "theme" as a prefix tho.

#6 in reply to: ↑ 4 @lancewillett
13 years ago

Replying to nacin:

I'm only referring tag_archive_meta and category_archive_meta. 16 different themes in http://wpcom-themes.svn.wordpress.org, including Twenty Eleven, Toolbox, and _s, use these "generic" filters. I'll defer to lancewillett and iandstewart as to whether they have seen this as intentional, or just subconscious copy-paste.

Not intentional, we should prefix all the things.

#7 follow-up: @nacin
13 years ago

Do we even need those filters, in that case? They seem redundant as there's a filter in tag_description(), etc.

#8 in reply to: ↑ 7 ; follow-up: @lancewillett
13 years ago

Replying to nacin:

Do we even need those filters, in that case? They seem redundant as there's a filter in tag_description(), etc.

Good point. I vote to remove in favor of existing filters in core.

#9 in reply to: ↑ 8 ; follow-ups: @obenland
13 years ago

I was just testing it, and the descriptions get put out as part of the <h1> tag. Is this by design?

#10 in reply to: ↑ 9 @lancewillett
13 years ago

Replying to obenland:

I was just testing it, and the descriptions get put out as part of the <h1> tag. Is this by design?

That's probably a regression, I'll double check with Drew and fix it up.

#11 in reply to: ↑ 9 @lancewillett
13 years ago

Replying to obenland:

I was just testing it, and the descriptions get put out as part of the <h1> tag. Is this by design?

@obenland, can you open a new ticket for the archive h1 thing? Keeping this one for the namespacing and filter issue.

#12 @lancewillett
13 years ago

  • Owner set to lancewillett
  • Resolution set to fixed
  • Status changed from new to closed

In [21268]:

Twenty Twelve: remove tag_description and category_description filters from archive template in favor of core filters. Fixes #21230.

@obenland
13 years ago

Namespace script and style handles

#13 @obenland
13 years ago

Alright, with templates not being in the public namespace and the two filters gone - that leaves the two script/style handles in functions.php --> 21230.2.diff

#14 @SergeyBiryukov
13 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#15 @lancewillett
13 years ago

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

In [21275]:

Twenty Twelve: proper namespace for two script/style handles in functions.php, props obenland. Fixes #21230.

Note: See TracTickets for help on using tickets.