Wordpress working locally then uploading
I have a couple of sites that I will be developing locally then when do开发者_StackOverflowne will upload to respective hosts.
I usually test out in Mamp, but this time will complete the whole site. I have had to move Wordpress sites to different directories before, which was a tad cumbersome.
Are there steps I can take during development that would help with publishing once the site is completed?
THanks.
Use php functions when building themes so as to not have to change directory paths in themes when changing hosts, like the get_bloginfo functions: http://codex.wordpress.org/Function_Reference/get_bloginfo
Use relative paths in css files, if possible.
And see http://codex.wordpress.org/Moving_WordPress for the best docs on the moving process.
After the move, if you need to change URLs of images within posts and pages (because you can't execute php in posts/pages without plugins and non-use of the visual editor), use SQL queries in phpmyadmin like:
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
精彩评论