$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>localhost - How to make other computer in local network see my theme|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

localhost - How to make other computer in local network see my theme

matteradmin10PV0评论

I have made WordPress Theme and have 2 themes in WordPress repository. So, I do not hard code my themes and pretty well how to use WordPress Theme goes to online.

I use WAMP server with 127.0.0.1 and my local IP is 192.168.100.103. Everything is ok in my computer.

Other computer, try to see my theme. And, only the HTML, the rest (js and css) is not loaded. I have checked with firebug. Then i see the path is http://localhost/wp-theme/css.. It should be http://192.168.100.103/wp-theme/css..

How to change the path? Or does any setting with WAMP?

I have made WordPress Theme and have 2 themes in WordPress repository. So, I do not hard code my themes and pretty well how to use WordPress Theme goes to online.

I use WAMP server with 127.0.0.1 and my local IP is 192.168.100.103. Everything is ok in my computer.

Other computer, try to see my theme. And, only the HTML, the rest (js and css) is not loaded. I have checked with firebug. Then i see the path is http://localhost/wp-theme/css.. It should be http://192.168.100.103/wp-theme/css..

How to change the path? Or does any setting with WAMP?

Share Improve this question asked Mar 5, 2015 at 5:56 ucon89ucon89 3261 gold badge3 silver badges7 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 8

Go to Admin Panel > Settings > General and replace localhost with your ip-address for WordPress Address (URL) and Site Address (URL) and see if it works. Also don't forget to put your WAMP server online.

If you are enqueueing your css with wp_enqueue_style, Wordpress will embed the site's url in the style call. Since you defined your site as "localhost", that's what you'll get (even if you access the site using the IP address instead of localhost).

If you are going to access your site from any other machine, defining the site's address as localhost (or 127.0.0.1) wont cut it. You need to use the ip address/domain of your machine, the same one you'll use in the second machine to access the one hosting the wp installation.

E.g.: machine hosting wp is on 192.168.100.103 On the Wamp machine you could add on your hosts file

site.local    127.0.0.1

And on the other machine's hosts file:

site.local 192.168.100.103

Then going to http://site.local in either of them will end up in the same machine.

Since your site is already configured, doing that wouldn't be enough. You need to change the URL in wordpress as well. E.g., in wp-home.php set:

define( 'WP_HOME', 'http://site.local' );

And if you have any content, menus, or anything like that, they'll be pointing to the old URLs. You need to reset them. You could do it by installing wp-cli and doing wp search-replace localhost site.local --recurse-objects; or you could just install this, and do the search replace in place as well.

Hope it all helps, and that you understand what's going on.

That didn't work for me. I found that I had to reinstall Wordpress using the IP address of the external PC as the Database Host. I could also use the WAN address from my ISP and view it from outside my local LAN.

Post a comment

comment list (0)

  1. No comments so far