- This topic is empty.
-
AuthorPosts
-
November 30, 2009 at 5:15 pm #26995casiodanParticipant
Hi folks,
I have built a wordpress site and have been using xampp to save time uploading to my web server all the time. Anyway when i have tried to view the site on another pc on my network i have noticed all the links to stylesheets and stuff like jquery have been saved with the full link. For example if i open firebug and look at my stylesheet call it shows as :
<link media="screen" type="text/css" href="http://localhost/wordpress/wp-content/themes/occasions/style.css" rel="stylesheet">
Obvioulsy i need it to be relative to the site root rather than the full link as when i upload it to the web its gonna mess things up.
I know there will be a simple fix for this and im gonna look stupid but i have looked everywhere.
Im using dreamweaver CS4 for my editing and using the built in file manager to upload to the xampp folder.
Thanks people
Dan
November 30, 2009 at 5:23 pm #67295TheDocMemberIt’s funny. I had this exact same question the other day, had a look on the web, couldn’t find my answer and gave up. I look for 25 seconds for you, and whamo!
<?php bloginfo(‘template_directory’); ?>
November 30, 2009 at 5:29 pm #67297casiodanParticipantSorry for being dumb. I know its an old line but im very new to WP. Do i just need to stick that in the head somewhere?
Thanks for the speedy response
Dan
**edit**
This is what the line looks like in my head section relating to the stylesheet
<link rel="stylesheet" href="<?php bloginfo(‘stylesheet_url’); ?>" type="text/css" media="screen" />
November 30, 2009 at 5:59 pm #67300TheDocMember"casiodan" wrote:This is what the line looks like in my head section relating to the stylesheet<link rel="stylesheet" href="<?php bloginfo(‘stylesheet_url’); ?>" type="text/css" media="screen" />
That’s exactly what it should look like for you stylesheet, don’t need to change that.
November 30, 2009 at 6:25 pm #67302casiodanParticipantOK, so im guessing what your saying is that the <?php bloginfo(‘template_directory’); ?> tells wp how to construct the links and i need to work out how to use it?
Thanks
Dan
November 30, 2009 at 6:36 pm #67303TheDocMemberExample using an image:
<img alt="" src="<?php bloginfo(‘template_directory’); ?>/images/your-image.jpg" />
The link that it will create will look something like this:
<img alt="" src="http://www.your-site.com/wp-content/themes/your-theme-name/images/your-image.jpg" />
November 30, 2009 at 6:39 pm #67304TeMcMemberOK.
I’ve had this exact same problem a month ago and it’s got nothing to do with those template_directory-tags !
Because you seem to be using them already, and it basicly doesn’t matter in most cases.The problem, as topicstarter described, is the full links.
Most likely your links start with localhost (that is, on your local machine). Since WordPress has saved this into it’s "General Settings", and since WordPress always makes full links. Even from another machine, the links will still start with localhost, and thuss fail, since the "another machine" isn’t the same localhost as your own computer.
To fix this there are several ways.
The easiest way is to open up wp-config.php and put in the following lines:
Code:Replace example.com with your local LAN IP-address (for example 192.168.178.104).
Then, no matter from where you are in your network ("LAN"), the site will still work.
—
TeMcNovember 30, 2009 at 6:49 pm #67307TheDocMemberTeMC, I don’t think that’s the problem that the user is describing. I think they were just concerned that their links were going to be for localhost when the site went live.
November 30, 2009 at 6:59 pm #67309casiodanParticipantOk Guys,
That has fixed the problem. My other machines were just displaying unstyled WP content because they were looking for localhost/ which obviously only applies to the machine running xampp. I suppose this is just a drawback to using a testing server.
When i upload this to my web server im guessing the config file will be ok because i will have run a fresh WP install to the server and the links will be pointing to the right place then??
Thanks for your help.
Dan
January 17, 2010 at 2:03 am #69526TeMcMember@casiodan: Yup, that’s how it goes.
For other users whom may find this, a short tip if you want your site to work in a local network (LAN) or other situation in which the link WordPress is configured in, does not work, or only works from 1 machine (ie. the localhost-issue as described above)
What you can do is edit wp-config.php and add the following two lines, where "example.com" is the NEW (if not) TEMPORARY domain of your site.
Code:So, if you’re in a local network (LAN) and it’s currently pointing to http://localhost (causing the site to be text-only from other computers) change it to something like 192.168.1.103
In Windows: Go Start -> Run -> type "cmd" (without "quotes") -> Hit Enter -> type "ipconfig" Hit Enter -> Check "IP Address")
or;
in Mac OS X / Unix : Go to Terminal (under Utilities in Applications) and type "ipconfig getifaddr en0" or "ipconfig getifaddr en1") and Press Return; alternativly go to System Preferences -> Network and see your local IP thereSee also: http://codex.wordpress.org/Changing_The … config.php
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.