Skip to main content
rewrote question so it is more readable and doesn't serve as example of incorrect hooks
Source Link
Rarst
  • 99.9k
  • 10
  • 161
  • 298

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use to:

  • Register Front End Scripts
  • Register Front End Styles
  • Enqueue Front End Scripts
  • Enqueue Front End Styles
  • Register Back End Scripts
  • Register Back End Styles
  • Enqueue Back End Scripts
  • Enqueue Back End Styles

So far I use

  • Register Front End Scripts - init
  • Register Front End Styles - init
  • Enqueue Front End Scripts - init
  • Enqueue Front End Styles - init
  • Register Back End Scripts - admin_initto register and/or enqueue
  • Register Back End Styles - admin_initscripts and styles
  • Enqueue Back End Scripts on front- admin_print_scripts-{xxx}
  • Enqueue Back End Styles and back- admin_print_stylesends?

Questions:

  • Did I get my hooksWhich are right hooks to use? Perhaps not, but if so ...
  • All front end register/enqueue scripts/styles in init?
  • Why is there no admin_print_styles-{xxx}?

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use to:

  • Register Front End Scripts
  • Register Front End Styles
  • Enqueue Front End Scripts
  • Enqueue Front End Styles
  • Register Back End Scripts
  • Register Back End Styles
  • Enqueue Back End Scripts
  • Enqueue Back End Styles

So far I use

  • Register Front End Scripts - init
  • Register Front End Styles - init
  • Enqueue Front End Scripts - init
  • Enqueue Front End Styles - init
  • Register Back End Scripts - admin_init
  • Register Back End Styles - admin_init
  • Enqueue Back End Scripts - admin_print_scripts-{xxx}
  • Enqueue Back End Styles - admin_print_styles

Questions:

  • Did I get my hooks right? Perhaps not, but if so ...
  • All front end register/enqueue scripts/styles in init?
  • Why is there no admin_print_styles-{xxx}?

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use:

  • to register and/or enqueue
  • scripts and styles
  • on front- and back-ends?

Questions:

  • Which are right hooks to use?
  • All front end register/enqueue scripts/styles in init?
  • Why is there no admin_print_styles-{xxx}?
Tweeted twitter.com/#!/StackWordPress/status/86365203104673793
Source Link
JM at Work
  • 2.3k
  • 6
  • 35
  • 42

Where is the right place to register/enqueue scripts & styles

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use to:

  • Register Front End Scripts
  • Register Front End Styles
  • Enqueue Front End Scripts
  • Enqueue Front End Styles
  • Register Back End Scripts
  • Register Back End Styles
  • Enqueue Back End Scripts
  • Enqueue Back End Styles

So far I use

  • Register Front End Scripts - init
  • Register Front End Styles - init
  • Enqueue Front End Scripts - init
  • Enqueue Front End Styles - init
  • Register Back End Scripts - admin_init
  • Register Back End Styles - admin_init
  • Enqueue Back End Scripts - admin_print_scripts-{xxx}
  • Enqueue Back End Styles - admin_print_styles

Questions:

  • Did I get my hooks right? Perhaps not, but if so ...
  • All front end register/enqueue scripts/styles in init?
  • Why is there no admin_print_styles-{xxx}?