Support » Fixing WordPress » Header Tag – Add CSS link

  • Where do I go if i wanted to add my own css to my site….
    I wanna add a few javascripts to my header tag… Where can I do this?

    Thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can edit the header.php in the directory of your active theme. It contains the header tags.


    Thanks for the reply.

    Open header.php
    In between your <head> </head> tags add your code

    <script type="text/javascript" src="path/mootools-release-1.11.js"></script>
    <script type="text/javascript" src="path/rokbox.js"></script>
    <link href="path/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="path/rokbox-config.js"></script>

    I was trying to get Rokbox to work. It’s like lightbox and thickbox but a little better… see a demo here … maybe someone else will have better luck than me.

    Just a note in case other people have this idea – a far, far better idea is to throw that stuff into a plugin file. It really isn’t much harder and it allows you to not lose all of your custom content whenever you upgrade/change your theme.

    Create a php file in wp-content/plugins, say ‘my_header_content.php’

    Put this in it:

    Plugin Name: My header content
    Plugin URI:
    Description: Add some custom header content
    Author: Me
    Version: 1.0
    Author URI:
    function my_header_content() {
      <!-- Put your custom header content here, between the ?> and <?php -->
    add_action( 'wp_head', 'my_header_content' ); // 'my_header_content' here is the name of the function above

    Then find the new plugin called ‘My header content’ in the plugins list and activate it. Voila, the ‘right way’.

    I’m somewhat new to amending code, but why can’t you create a php file and input the addcss function ? Why do you need to do this as a plugin ?

    Hi I’m writing a plugin to add some options to the admin post area.

    I would like to add my own css style sheet or any script file I may have to the admin header tag without having to manually add anything to the wordpress files.

    Is there a function that will do this?

    I assumed the function above was for the blog site itself not the admin pages.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Header Tag – Add CSS link’ is closed to new replies.