[theme-reviewers] Hooking wp_enqueue_script( 'comment-reply' ) into wp_head

Edward Caissie edward.caissie at gmail.com
Thu Apr 21 18:57:35 UTC 2011


The only thing that comes to mind is if any add_action requires the highest
priority to be used "correctly" then perhaps it should be submitted as a
core requirement (optional in settings?) ... just a thought; otherwise your
function example looks fine.


Cais.

On Thu, Apr 21, 2011 at 2:44 PM, Chip Bennett <chip at chipbennett.net> wrote:

> One more for today:
>
> Most Themes drop the wp_enqueue_script( 'comment-reply' ) code directly
> into the document head, but it *can* be hooked into wp_head, if given the
> correct priority.
>
> I *think* wp_enqueue_styles fires at priority 1 in wp_head. Regardless,
> passing priority 0 to the enqueue function *does* work. e.g.:
>
> function oenology_enqueue_comment_reply() {
> if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
> {
>  wp_enqueue_script( 'comment-reply' );
> }
> }
> add_action( 'wp_head', 'oenology_enqueue_comment_reply', 0 );
>
>
> Notice that I've also added a comments_open() to the conditional.
>
> Any comments/ideas/suggestions?
>
> Chip
>
> _______________________________________________
> 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/20110421/4d7dab9b/attachment.htm>


More information about the theme-reviewers mailing list