Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#12371 closed defect (bug) (fixed)

Change get_generic_template's name

Reported by: filosofo's profile filosofo Owned by: westi's profile westi
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords: get_generic_template has-patch
Focuses: Cc:

Description (last modified by filosofo)

  • get_generic_template needs a better name, because its purpose is to get a specific template. Even the original documentation recognizes this (emphasis mine):
    • "if a name is specified then a specialised template will be included."
    • "For the parameter, if the file is called "{slug}-special.php" then specify "special".
  • What follows "get_" in the function name should indicate the thing "gotten," according to general WP practice (and good function naming in general).
  • In the case of this function a specific template is requested, never a general one.
  • To put this another way, if get_generic_template were true to its name it would have no arguments at all and just locate the index.php template.

Attachments (1)

generalize_template_logic.12371.diff (4.2 KB) - added by filosofo 14 years ago.

Download all attachments as: .zip

Change History (11)

#1 @filosofo
14 years ago

  • Description modified (diff)
  • Summary changed from Generalize get_generic_template()'s logic (and improve its name) to Change get_generic_template's name

I had second thoughts about my half-baked logic changes.

#2 follow-up: @nacin
14 years ago

I was giving a talk on 3.0 last night and mentioned that there will be a "get_loop()-like" function, noting that the name will probably change. I think I like get_specific_template(), at least over get_generic_template().

Maybe this can be brainstormed at the end of or just after the dev chat when there's a handful of developers around to fire names back and forth, then come to a consensus? (Without it devolving into a bikeshed discussion.)

#3 in reply to: ↑ 2 @filosofo
14 years ago

Replying to nacin:

Maybe this can be brainstormed at the end of or just after the dev chat when there's a handful of developers around to fire names back and forth, then come to a consensus? (Without it devolving into a bikeshed discussion.)

I'm not wedded to get_specific_template: almost anything's better than get_generic_template.

However, since the "bikeshed" thing came up last week I feel like I need to explain why I will avoid a "bikeshed discussion." The "bikeshed discussion"

is a metaphor indicating that you need not argue about every 
little feature just because you know enough to do so.

In the specific example involving the bike shed, the other vital
component is an atomic power-plant, I guess that illustrates the
age of the book.

Parkinson shows how you can go in to the board of directors and
get approval for building a multi-million or even billion dollar
atomic power plant, but if you want to build a bike shed you will
be tangled up in endless discussions.

Parkinson explains that this is because an atomic plant is so vast,
so expensive and so complicated that people cannot grasp it, and
rather than try, they fall back on the assumption that somebody
else checked all the details before it got this far.   Richard P.
Feynmann gives a couple of interesting, and very much to the point,
examples relating to Los Alamos in his books.

A bike shed on the other hand.  Anyone can build one of those over
a weekend, and still have time to watch the game on TV.  So no
matter how well prepared, no matter how reasonable you are with
your proposal, somebody will seize the chance to show that he is
doing his job, that he is paying attention, that he is *here*.

In Denmark we call it "setting your fingerprint".  It is about
personal pride and prestige, it is about being able to point
somewhere and say "There!  *I* did that."  It is a strong trait in
politicians, but present in most people given the chance.  Just
think about footsteps in wet cement.

I bow my head in respect to the original proposer because he stuck
to his guns through this carpet blanking from the peanut gallery,
and the change is in our tree today.  I would have turned my back
and walked away after less than a handful of messages in that


In other words, something becomes a bikeshed discussion when

  • the topic is trivial
  • the interlocutors are
    • intransigent
    • arguing so as to show off their limited knowledge
    • knowledgeable of only basic things

That means that saying to someone that he's engaging in a bikeshed discussion is an insult: Essentially, "you are unknowledgeable and being intransigent about trivial things."

I'm happy to brainstorm about this or other WP proposals, but I won't be intransigent. It isn't that important. I've made this ticket with an alternate suggestion, but if the commit devs decide to leave it as get_generic_template I won't be overly concerned; I won't argue about it any more; you won't see me bringing it up on WP-Hackers.

#4 @westi
14 years ago

  • Owner set to westi
  • Status changed from new to accepted

#5 @westi
14 years ago

After a long walk and a think I am going to propose and introduce:


{{{Load a template part.

Makes it easy for a theme to reuse sections of code in a easy to overload way for child themes.}}}

#6 @filosofo
14 years ago

get_template_part sounds good to me.

#7 @westi
14 years ago

(In [13815]) Rename get_specific_template as get_template_part so as to make it clearer as to the point of the function. See #12371

#8 @westi
14 years ago

(In [13816]) Switch to get_template_part Fixes #12371. Try on some narrative comments for size see #12695.

#9 @scribu
14 years ago

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

#10 @demetris
14 years ago

get_template_part is very clear. Thanks, westi!

Note: See TracTickets for help on using tickets.