[wp-hackers] wordpress function naming convention

Drew xoodrew at gmail.com
Thu Feb 21 23:24:17 UTC 2013


>
>    - __()
>    - _e()
>    - _x()
>    - _ex()
>    - _n()
>
> are for Internationalization!
>

Rafael is correct about internationalization functions. I didn't really
spell out the distinction between translation functions and private core
functions.


   - _wp_words()
   - _words()

^ Are generally the format private core functions take.

Most/all internationalization functions like those listed by Rafael live in
wp-includes/l10n.php


On Thu, Feb 21, 2013 at 4:14 PM, Rafael Ehlers <rafaehlers at gmail.com> wrote:

>    - __()
>    - _e()
>    - _x()
>    - _ex()
>    - _n()
>
> are for Internationalization!
>
> http://ottopress.com/2012/more-internationalization-fun/
>
> 2013/2/21 Drew <xoodrew at gmail.com>
>
> > In my experience:
> >
> >    - the_X() - These are called "Template Tags". Generally, they echo a
> >    formatted version of their "get_the_X" counterpart, though there are
> >    several exceptions to this.
> >    - get_the_X() - Returns something (usually used by Template Tags)
> >    - wp_the_X() - Basically the same as the_X() but not as front-facing
> as
> >    Template Tags. They *are* public functions though
> >    - wp_get_the_X() - Returns something (usually used by wp_the_X()
> >    functions)
> >    - _X() - Private functions for use by WordPress core only.
> >
> > Anybody else, CMIIW.
> >
> >
> > On Thu, Feb 21, 2013 at 2:56 PM, Haluk Karamete <halukkaramete at gmail.com
> > >wrote:
> >
> > > Could someone guide as to what the convention is when we see a
> > > wordpress function which starts with one of these
> > >
> > > the_X()
> > >
> > > get_the_X()
> > >
> > > wp_the_X()
> > >
> > > wp_get_the_X()
> > >
> > > and very rarely some core functions start with _.
> > >
> > > as to the template tags, the convention is easy to understand, the_X
> > > outputs the X inline, whereas get_the_X returns the value.
> > >
> > > But for all the rest, not too sure.
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> >
> >
> >
> > --
> > -- I've kinda got a thing for WordPress > http://www.drewapicture.com
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
-- I've kinda got a thing for WordPress > http://www.drewapicture.com


More information about the wp-hackers mailing list