[theme-reviewers] get_template_part vs locate_template

Edward Caissie edward.caissie at gmail.com
Fri Apr 22 20:02:30 UTC 2011


Yep ... what Chip said (*grin*).


Cais.

On Fri, Apr 22, 2011 at 3:55 PM, SFNdesign <curtis at curtismchale.ca> wrote:

> I put it on my list. The only reason I mentioned it earlier was because
> others had a better grasp on it. I'm happy to do it.
>
> Curtis McHale
> 604.751.3482
>
> On 2011-04-22, at 12:53 PM, Chip Bennett <chip at chipbennett.net> wrote:
>
> And if I'm reading Cais correctly, I would say that this instance (use of
> get_template_part() vs locate_template()) would be a good example of an
> instance where the Codex could be edited to clarify, without any needed
> discussion beforehand, if you are comfortable with providing a more detailed
> explanation. (As a courtesy, you could email the list to say, "hey, I made
> this change" - but several people "watch" that Codex page, so changes don't
> go unnoticed, anyway. ;) )
>
> Chip
>
> On Fri, Apr 22, 2011 at 2:49 PM, Edward Caissie <<edward.caissie at gmail.com>
> edward.caissie at gmail.com> wrote:
>
>> Actually, as I see it, those especially involved with doing Theme reviews
>> should be addressing items on the related codex pages regarding the
>> guidelines that are being used.
>>
>> IF there is some sort of ambiguity or confusion then it should be
>> addressed. If there is a concern on how the item is to be addressed, it can
>> be easily discussed here then addressed in the codex.
>>
>>
>> Cais.
>>
>>
>> On Fri, Apr 22, 2011 at 2:48 PM, Chip Bennett < <chip at chipbennett.net>
>> chip at chipbennett.net> wrote:
>>
>>> It's just like any other WordPress Codex page - especially for something
>>> like clarifying a requirement, feel free to edit!
>>>
>>> Chip
>>>
>>>
>>> On Fri, Apr 22, 2011 at 1:46 PM, Curtis McHale <<curtis at curtismchale.ca>
>>> curtis at curtismchale.ca> wrote:
>>>
>>>> Yes I do and I've updated lots of other pages, just not sure I had the
>>>> 'clout' to update this with all of the information of some of the others on
>>>> the list.
>>>>
>>>>
>>>> Curtis McHale
>>>> PH: 604.751.3482
>>>>  <http://www.curtismchale.ca>http://www.curtismchale.ca
>>>> Linkedin: <http://www.linkedin.com/in/curtismchale>
>>>> http://www.linkedin.com/in/curtismchale
>>>> Twitter: <http://twitter.com/curtismchale>twitter.com/curtismchale
>>>>
>>>>
>>>>
>>>> On Fri, Apr 22, 2011 at 11:43 AM, Chip Bennett < <chip at chipbennett.net>
>>>> chip at chipbennett.net> wrote:
>>>>
>>>>> You know it's a *wiki*, right? ;)
>>>>>
>>>>> Chip
>>>>>
>>>>>
>>>>> On Fri, Apr 22, 2011 at 1:10 PM, Curtis McHale <<curtis at curtismchale.ca>
>>>>> curtis at curtismchale.ca> wrote:
>>>>>
>>>>>> I just looked at the theme review guidelines and it's probably worth
>>>>>> clarifying them in regard to locate_template and get_template_part.
>>>>>> Currently they say to use get_template_part to include custom template
>>>>>> files. It's actually listed as *required* which obviously could cause
>>>>>> confusion.
>>>>>>
>>>>>>
>>>>>> Curtis McHale
>>>>>> PH: 604.751.3482
>>>>>> <http://www.curtismchale.ca>http://www.curtismchale.ca
>>>>>> Linkedin: <http://www.linkedin.com/in/curtismchale>
>>>>>> http://www.linkedin.com/in/curtismchale
>>>>>> Twitter: <http://twitter.com/curtismchale>twitter.com/curtismchale
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Apr 22, 2011 at 10:58 AM, Curtis McHale <<curtis at curtismchale.ca>
>>>>>> curtis at curtismchale.ca> wrote:
>>>>>>
>>>>>>> Thanks for all the information. I'll include the proper usage in my
>>>>>>> theme notes.
>>>>>>>
>>>>>>>
>>>>>>> Curtis McHale
>>>>>>> PH: 604.751.3482
>>>>>>> <http://www.curtismchale.ca>http://www.curtismchale.ca
>>>>>>> Linkedin: <http://www.linkedin.com/in/curtismchale>
>>>>>>> http://www.linkedin.com/in/curtismchale
>>>>>>> Twitter: <http://twitter.com/curtismchale>twitter.com/curtismchale
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Apr 22, 2011 at 10:15 AM, Chip Bennett <<chip at chipbennett.net>
>>>>>>> chip at chipbennett.net> wrote:
>>>>>>>
>>>>>>>> So, I found the code you're talking about<http://themes.svn.wordpress.org/wiredrive-classic/1.0.1/css/custom-css.php>
>>>>>>>> .
>>>>>>>>
>>>>>>>> The correct way to do this:
>>>>>>>>
>>>>>>>> 1) Wrap that output in a function, e.g.:
>>>>>>>>
>>>>>>>> function wiredrive-classic_custom_css() {
>>>>>>>>      include( get_template_directory() . '/css/custom-css.php' );
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> 2) Enqueue the function (increase priority as needed):
>>>>>>>>
>>>>>>>> add_action( 'wp_print_styles', 'wiredrive-classic_custom_css', 11 );
>>>>>>>>
>>>>>>>>
>>>>>>>> And that's it.
>>>>>>>>
>>>>>>>> Chip
>>>>>>>>
>>>>>>>> On Fri, Apr 22, 2011 at 11:34 AM, Curtis McHale <<curtis at curtismchale.ca>
>>>>>>>> curtis at curtismchale.ca> wrote:
>>>>>>>>
>>>>>>>>> I'm reviewing a theme and I've found uses of get_template_part
>>>>>>>>> where I believe that locate_template is the proper item. Specifically the
>>>>>>>>> code below loads the custom stylesheet.
>>>>>>>>>
>>>>>>>>> <?php get_template_part('css/custom-css')?>
>>>>>>>>>
>>>>>>>>> It was my understanding that in this case we should use:
>>>>>>>>>
>>>>>>>>> <?php locate_template( array( '/css/custom-css.css' ), 1); ?>
>>>>>>>>>
>>>>>>>>> and that get_template part was to call a file in the same directory
>>>>>>>>> like loop-main.php. Is there established best practice and if so what is it?
>>>>>>>>> Is the use above an okay way to call a custom stylesheet in to the theme? If
>>>>>>>>> not what way is currently advised?
>>>>>>>>>
>>>>>>>>> Curtis McHale
>>>>>>>>> PH: 604.751.3482
>>>>>>>>> <http://www.curtismchale.ca>http://www.curtismchale.ca
>>>>>>>>> Linkedin: <http://www.linkedin.com/in/curtismchale>
>>>>>>>>> http://www.linkedin.com/in/curtismchale
>>>>>>>>> Twitter: <http://twitter.com/curtismchale>twitter.com/curtismchale
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> theme-reviewers mailing list
>>>>>>>>>  <theme-reviewers at lists.wordpress.org>
>>>>>>>>> theme-reviewers at lists.wordpress.org
>>>>>>>>>  <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>>>>>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> theme-reviewers mailing list
>>>>>>>>  <theme-reviewers at lists.wordpress.org>
>>>>>>>> theme-reviewers at lists.wordpress.org
>>>>>>>>  <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>>>>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> theme-reviewers mailing list
>>>>>>  <theme-reviewers at lists.wordpress.org>
>>>>>> theme-reviewers at lists.wordpress.org
>>>>>>  <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> theme-reviewers mailing list
>>>>>  <theme-reviewers at lists.wordpress.org>
>>>>> theme-reviewers at lists.wordpress.org
>>>>>  <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> theme-reviewers mailing list
>>>>  <theme-reviewers at lists.wordpress.org>
>>>> theme-reviewers at lists.wordpress.org
>>>>  <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>
>>>>
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>>  <theme-reviewers at lists.wordpress.org>
>>> theme-reviewers at lists.wordpress.org
>>>  <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>>
>>
>> _______________________________________________
>> theme-reviewers mailing list
>>  <theme-reviewers at lists.wordpress.org>theme-reviewers at lists.wordpress.org
>>  <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110422/29e80a26/attachment.htm>


More information about the theme-reviewers mailing list