WordPress.org

Ready to get started?Download WordPress

Forums

Stylesheet directory code snippet (3 posts)

  1. Stef
    Member
    Posted 3 years ago #

    Hi!

    Usually the link to a stylesheet is called using this line of code:

    <?php bloginfo( 'stylesheet_url' ); ?>

    This line use the URL to point to the stylesheet location. But that won't work on the site I'm working on, because it has two URL's pointing to the same site.
    Would it be possible to point to a directory? For example with this piece of code:

    $current_stylesheet_dir

    Thanks a lot in advance!

  2. Digital Raindrops
    Member
    Posted 3 years ago #

    Hi Stef,
    The main call for style.css in header.php and this file name should only exists the once, and does not need the file name:
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

    Not sure what you mean by two URL's, do you mean you have two files?

    If you do the second file should not start with style and you can call it like this, UNTESTED code:

    If you had a second stylesheet in a subfolder /styles/ in a parent theme:
    <link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri() .'/styles/custom.css"'; ?> media="all" />

    If you use a child theme and had a second stylesheet in a subfolder /styles/ in a child theme:
    <link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_directory_uri() .'/styles/custom.css"'; ?> media="all" />

    HTH

    David

  3. Stef
    Member
    Posted 3 years ago #

    The problem is that I have two urls pointing to the same site:
    - http://www.noinknoglory.com/
    - http://www.noinknoglory.nl/

    Firefox doesn't want to load my custom fonts... That's the problem :)

Topic Closed

This topic has been closed to new replies.

About this Topic