This has happened on a number of occasions now where I move my site from Localhost to Live environment and the theme settings such as the logo, and other settings are not copied with it, so I am almost have to rebuild the site twice sometimes.
Responsive is one example where this is happening as well as numerous other themes I move from Localhost to Live environment.
Is there something I am missing when move the DB over? Perhaps another settings file?
Many thanks
Since I found this script, I have used it for every single move I make from Localhost to Live or vice versa.
It’s incredibly simple to use and has worked every time.
https://github.com/interconnectit/Search-Replace-DB (Review: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ )
From their site:
You must use a safe search and replace method that preserves the integrity of the serialized string lengths. A simple find and replace of a dump file for
http://localhost
to, for example,http://examplesite.com
is problematic because the length of the string changes but the indexes for the serialized strings does not. Consequently settings are lost and widgets disappear.Most of the the main functionality of a theme is specified in the
functions.php
. And the responsive thing is defined generally into thestyle.css
.But if you are using any plugin, then there can be many things that are done by them. Even a specification in
functions.php
can be overridden by a plugin hook, or vice versa. So copying a complete site isn’t just the theme. You have to:theme
folder for the themeplugins
folder for the pluginsuploads
folder for the files you’ve uploaded with the WordPress media uploaderdatabase
for the website settingsLet’s talk about business:
I follow an easy process taught by my colleague and teacher Ms. Tahmina Aktar. The process is:
From localhost to web server migration
Step 1a: In your localhost, find your project folder, not just the theme (in the case of WAMP, it’s
C:\wampwwwmy_project
)Step 1b: Compress it into
.zip
archive (NOT in.rar
or.ace
etc.) – so it’d bemy_project.zip
.Step 1c: Browse the
http://localhost/phpmyadmin
in browser and “Export” all the tables of your database. (Suppose that’s themy_project.sql
)Step 2a: Go to the cPanel of your site:
http://www.mysite.com/cpanel
and open the “File manager”.Step 2b: “Upload” the
my_project.zip
file into thepublic_html
folder and “Extract” it (so that it’d bemy_project
folder)Step 2c: Open the folder, “Select all” and “Move” to just one level up (from
/public_html/my_project
to/public_html/
), and then delete the emptymy_project
folder now – it has no need.So, your project is up – completely. You just have to upload the db and configure the site to the db. But I hope you can get that, the sql file you exported from the localhost holds all the URL for your local PC. So you have to change ’em to server-specific.
So now, Open the
my_project.sql
file into a NotePad++ (Because NotePad++ won’t make your system lazy or idle even if the db is huge)Now press Ctrl + F to “Find”, and on the text box, type: “
http://localhost/mywebsite
” and then click on the “Replace” tab, and type your server URL, like: “http://www.example.com
“.Now find and replace individually or you can “Find” and “Replace all”.
And then Save the file as
my_project-server.sql
.Now go for the final steps:
my_project_server.sql
).So, the full & final step:
Final Step: From the File Manager, under
public_html/
, Open thewp-config.php
into Editor/Code Editor mode, and change the following lines into:/** The name of the database for WordPress */
define(‘DB_NAME’, ‘
database_name_here
‘);/** MySQL database username */
define(‘DB_USER’, ‘
database_user_name_here
‘);/** MySQL database password */
define(‘DB_PASSWORD’, ‘
database_password_here
‘);Save the file and Browse your site as you’ve seen in localhost. 🙂
I just lost all my theme settings when transferring from localhost to server.
Then I discovered in my Appearance | Theme Settings an option to Import/Export code.
I think you can use this to transfer settings from within the Theme options panel.
I didn’t try it cos I had already set everything up again.
But might be handy for another transfer installation.