Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#21230 closed enhancement (fixed)

Twenty Twelve: Namespace all the things

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

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 14 years ago.
21230.2.diff (1.0 KB ) - added by obenland 14 years ago.
Namespace script and style handles

Download all attachments as: .zip

Change History (17)

@obenland
14 years ago

#1 follow-up: @nacin
14 years ago

  • Milestone Awaiting Review3.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
14 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
14 years ago

  • Cc lancewillett added

#4 follow-up: @nacin
14 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
14 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
14 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
14 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
14 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
14 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
14 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
14 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
14 years ago

  • Owner set to lancewillett
  • Resolutionfixed
  • Status newclosed

In [21268]:

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

@obenland
14 years ago

Namespace script and style handles

#13 @obenland
14 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
14 years ago

  • Resolution fixed
  • Status closedreopened

#15 @lancewillett
14 years ago

  • Resolutionfixed
  • Status reopenedclosed

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.