treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wordpress Woes

  • I'm doing Chris's Creating and Editing Custom Themes from Lynda.com and using the exercise files and am having a lot of trouble with the links and paths to files and images. For example, Chris puts the product.css file in the theme and links to it from the header using
    <?php if (is_page_template('page-product.php')) { ?>	
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?> /css/product.css">
    <?php } ?>

    If I put it in the same place and use the same link, it doesn't link.
    I have tried putting it in the root of the theme like style.css and linking with either /product.css or product.css , still no joy
    The only way I can get it to show is to paste the css into the style.css

    The .htaccess file is as follows:
    [code]# BEGIN WordPress

    RewriteEngine On
    RewriteBase /widgetcorpWP/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /widgetcorpWP/index.php [L]

    # END WordPress
    [/code]

    Am I right in thinking that this has something to do with it? Any ideas, this is driving me nuts.
  • Hey :)

    do you have a space in the real code?

    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>*SPACE HERE*/css/product.css">


    Coz that would probably be outputting:

    http://yoursite.com/wp-content/themes/yourtheme /css/product.css


    which would break, as you can see :)
  • Thanks, but that's not it, I tried several things and have removed the space in the code, it's good to know that.
    Got it now, sometimes the brain gets stuck on one thing and can't see anything else. The template name had a typo.
    Thanks
  • Ahh the good old typo :D