14 Responses

  1. Rarst
    Rarst Published |

    Why admin_head-$hook_suffix rather than admin_print_styles-$hook_suffix and admin_print_scripts-$hook_suffix? It doesn’t matter much all of these next to each other, but latter seem more semantically fitting as for me.

    Reply
  2. The Frosty
    The Frosty Published |

    Now if everyone would just add-hear.

    Reply
  3. Theo
    Theo Published |

    Well, this is great stuff, especially as you can apply it for custom stylesheets too.

    Reply
  4. R.Bhavesh
    R.Bhavesh Published |

    Thanks very much for this tutorial Justin. This will really come handy and help us build better themes.

    Absolutely love the tutorials in here.

    Reply
  5. onioneye
    onioneye Published |

    Up until now, I was printing my scripts and stylesheets on every admin page. *turns his head towards the wall of shame*

    Reply
  6. L’Hebdo WordPress : Enquête WordPress – iPhone – +1 | Choisir-son-CMS.tk
  7. Daniel Roch
    Daniel Roch Published |

    Many developers forget to use the right function to add content in the head section of a wordpress theme. Your code is great, but i have doubts that many people would use it in the admin side of a WordPress blog…

    Reply
  8. Link-urile lunii iulie | Staicu Ionuţ-Bogdan
  9. Shawn
    Shawn Published |

    What if you need a script to load for multiple admin pages, but still not all. For instance, if I am using a metabox option to upload images for use within a post-type, and I only want the javascript to load for that particular post type, what would the process be?

    The script would need to be available in the “post-new.php?post_type=XXX” and also in the “post.php” for editing the post.

    Would it be best to use multiple hooks such as :

    $post_page = ‘post-new.php?post_type=XXXX’;
    $post_edit_page = ‘post.php’;

    Doesn’t seem to be a way to specify post type on edit pages…

    Reply
  10. Dear theme developers, this is how you add scripts in WordPress themes | WPCandy
  11. Torstein Opperud
    Torstein Opperud Published |

    Ah, nice! This was just what I was looking for! I want to include a small google-map in a custom post types editor-pages, and I’d prefer to do it the right way! Thanks Justin!

    Reply
  12. Larry Bradshaw
    Larry Bradshaw Published |

    Is there anyway to editing an existing theme to remove the call from the Admin if it’s not needed at all? What files and what could would need to be commented out?

    Reply
  13. Nagendra
    Nagendra Published |

    How do I load a javascript through a plugin to run on website front-end ? (for a particular file say http://www.website.com/products )

    Reply

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.

css.php