SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WordPress Plugin Quesiton

    I'm creating my first Wordpress plugin. It's going good.
    My question is getting the JS and CSS files written in the head.

    I have used this code:

    PHP Code:
    add_action('wp_head''addHeaderCode');
    function 
    addHeaderCode() {
        echo 
    "\n".'<!-- Start Obama2008 -->'."\n";
        echo 
    '<link type="text/css" rel="stylesheet" href="' get_bloginfo('wpurl') . '/wp-content/plugins/obama2008ribbon/obama2008ribbon.css" />' "\n";
            
        
    wp_register_script('obama2008ribbon'get_bloginfo('wpurl') . '/wp-content/plugins/obama2008ribbon/obama2008ribbon.js');
        
    wp_print_scripts('obama2008ribbon');
        
            echo 
    '<!-- End Of Obama2008 -->'."\n"

    This code WORKS, but is this the best way to do it?

  2. #2
    Google Zombie ssandecki's Avatar
    Join Date
    Aug 2007
    Location
    Chicago, IL
    Posts
    665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not to sure with Wordpress plugins, did you try there community forums? I know they also have some great doucmentation on wordpress plugin creation on their site, this is probably near the top of that page

    If you don't mind me asking, what is it? An Obama 2008 widget?

  3. #3
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ssandecki View Post
    If you don't mind me asking, what is it? An Obama 2008 widget?
    It's a plugin for WordPress that puts an Obama 2008 ribbon in the upper right corner of a blog. You can learn more here.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •