Thursday 11. March 2010
Javascript and CSS options in Wordpress
05.07.2009 15:38

When posting website code and features it is nice to have the option to add some specific examples for demonstration usage. In Wordpress I couldn’t find any options to easily add custom Javascript or CSS for a blog post or page update.

There is an option to add meta data to a page, but as I understand, this requires that you configure the template to know these names, before it can output it. I thought it would be easier, if you can have 2 fields in the advance options – one for Javascript and one for CSS, so I made a small plugin for Wordpress which adds these two options.

Plugin is found her: EasyJSCSS

EasyJSCSS Plugin

Tags: ,

5 Responses to “Javascript and CSS options in Wordpress”

  1. Kirk Ward Says:

    Was reading you page and it said put the wp_head call in my template. Where?

    Thanks,
    KW

  2. js - huuah Says:

    The wp_head() call should be inserted in the header.php just before the </head>-tag.

    Something like this:

    header.php

    ...
    <head>
    ...
    <?php wp_head(); ?>
    </head>
    ...

  3. Nathanael Jones Says:

    Hey… Great idea – this is what I’ve been looking for… but
    Running into a big problem… When I enable this plugin with wordpress 2.8.5, I get raw php code at the top of each page, even in the admin interface.

  4. js - huuah Says:

    I have just upgraded my Wordpress to 2.8.5 and I can not reproduce the error with raw php output.
    You are welcome to email me some further details about the problem. Can I see the problem somewhere? What php code have you inserted in your template?

  5. Kent Says:

    According to this article [ http://codex.wordpress.org/Function_Reference/add_post_meta ], it seems appropriate to prefix the post-meta keys with an underscore so they don’t show up in the Custom Fields box. Currently they are duplicated in the admin UI and I’m not sure which field takes precedence.

Leave a Reply