Support » Fixing WordPress » Can bloginfo be used to make a relative link?

  • I want to call up another stylesheet in my template and have been playing with the bloginfo code to see if it will let me write in another one in my header.php without using a hard link.

    I’ve tried:

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory')/navigation.css; ?>" />

    but it just outputs the directory, ignoring the ‘/navigation.css” bit. Is there a way to do this?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Relative links will be problematic if you are using permalinks. For example if you have

    blog.domain.com/post/1 and you try to make a link to “wp-content/themes/yourtheme/stylesheet.css” the browser will try to load “[website_directory]/post/wp-content/themes/yourtheme/stylesheet.css”.

    Is there any reason you’re trying to use relative links? Or did I misunderstand your question?

    Thread Starter keress

    (@keress)

    I’m just trying to use it for the usual reason, if there’s a change at some point in the url, the link won’t need to be changed.

    Thread Starter keress

    (@keress)

    Hmm. I’m not seeing that. I have this line in my header.php

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory')/navigation.css; ?>" />

    and it’s producing this:

    <link rel="stylesheet" type="text/css" href="http://www.hearingsolutionstriangle.com/wp-content/themes/hearwell" />

    If I can just get it to add the “navigation.css” bit I’ll have what I want.

    I thought the conventional wisdom was that we are ‘supposed’ to use relative links as much as possible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can bloginfo be used to make a relative link?’ is closed to new replies.