• 0

Wordpress Linking


Question

I think i made a post a while back but i never got it solved but anyway...

When I'm linking to an image it's not starting from the theme directory where i would do /images/image.jpg. It used to do this but im not sure. Now im having to do /wp-content/themes/themename/images/image.jpg. This is really a pain, It could be my theme because i made it myself. I'll post the header because maybe theres something wrong with it.

Thanks (:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">

	<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />	
	<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
	<style type="text/css" media="screen">
		@import url(../rainbowsheep/style.css);
	</style>
	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
	<meta name="msvalidate.01" content="91E2F00FBC74CB572E10663FED575CF1" />


	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>



	<?php wp_get_archives('type=monthly&format=link'); ?>
	<?php //comments_popup_script(); // off by default ?>
	<?php wp_head(); ?>
</head>
<body>
	<div id="container">

			<div id="wrapper">

Link to comment
https://www.neowin.net/forum/topic/790000-wordpress-linking/
Share on other sites

5 answers to this question

Recommended Posts

  • 0
What seems to be the problem ? Are you getting any error messages ?

There aren't any error messages. This is whats happening

My theme is in wp-content/themes/myspace/

Images are in wp-content/themes/myspace/images

when im editing the index file to include images i have to use /wp-content/themes/myspace/images/blah.png

i can't just use images/blah.png even though its in the same directory as the images folder. But when im in the css file i can use images/blah.png

  • 0
There aren't any error messages. This is whats happening

My theme is in wp-content/themes/myspace/

Images are in wp-content/themes/myspace/images

when im editing the index file to include images i have to use /wp-content/themes/myspace/images/blah.png

i can't just use images/blah.png even though its in the same directory as the images folder. But when im in the css file i can use images/blah.png

oh! that's because the index file is actually "ran" from the root folder whereas the css file is "ran" from within the theme directory. (note neither is actually "ran" in the programming sense...I just couldn't think of a better word for it).

although instead of the hard link you should use

"<?php bloginfo('template_directory'); ?>/image/blah.png"

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.