[theme-reviewers] Custom javascript includes

George Mamadashvili georgemamadashvili at gmail.com
Mon Feb 20 09:30:10 UTC 2012


Unfortunately most of the themes have JS enqueue issues, maybe we should
update Theme Development codex about JS  and add more info how to do it
right.

http://codex.wordpress.org/Theme_Development#JavaScript

On Mon, Feb 20, 2012 at 11:37 AM, Emil Uzelac <emil at themeid.com> wrote:

> You're correct, as it says:
>
> /* Always have wp_footer() just before the closing </body>
> * tag of your theme, or you will break many plugins, which
> * generally use this hook to reference JavaScript files.*/
>
> Hook means from i.e. functions.php, no inline JS, author needs to
> use wp_enqueue_scripts instead:
> http://wpdevel.wordpress.com/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/
>
> While going over footer.php in Theme in question I've noticed this:
>
> style="display:inline;
>
> styles must be moved to style.css and never added to DIVs directly.
> Another "bad" practice is <div class='clearfix'></div> too, however some
> will let this pass because it's not trivial issue, I personally would
> not recommend that.
>
> Also see: http://nicolasgallagher.com/micro-clearfix-hack/
>
> Emil
>
> On Mon, Feb 20, 2012 at 12:57 AM, Paul Appleyard <paul at spacecat.com>wrote:
>
>> Hi all
>>
>> The author is including some custom javascript at the end of the footer -
>> the script is located within the theme directory. Does this need to be
>> enqueued also? I'm also thinking he might need to enclose or namespace the
>> functions here a little as well .. one of the (javascript) functions,
>> light_box(), seems in danger of clashing with other plugins and such at
>> some stage.
>>
>> Paul
>> ______________________________**_________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20120220/24fc222e/attachment-0001.htm>


More information about the theme-reviewers mailing list