Most of the the main functionality of a theme is specified in the functions.php
. And the responsive thing is defined generally into the style.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:
- copy the
theme
folder for the theme
- copy the
plugins
folder for the plugins
- copy the
uploads
folder for the files you've uploaded with the WordPress media uploader
- copy the
database
for the website settings
Let'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:\\wamp\www\my_project
)
Step 1b: Compress it into .zip
archive (NOT in .rar
or .ace
etc.) - so it'd be my_project.zip
.
Step 1c: Browse the http://localhost/phpmyadmin
in browser and "Export" all the tables of your database. (Suppose that's the my_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 the public_html
folder and "Extract" it (so that it'd be my_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 empty my_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
.
NOTE: Remember the Forward Slash (/) at the end of the URL. If you typed http://localhost/mywebsite/
in find box, then of course type http://www.example.com/
in replace box. Otherwise the file structure can be broken, like: examplewp-content/themes/...
or example//wp-content/themes/...
.
Now go for the final steps:
- Step 3a: Open the "MySQL databases" in the cPanel. Create a database, then Add a User and set a strong password for the user, and then Specify the db to the User, and give all the privileges except the "Drop". (Must copy all the 3 info - db_name, user_name, and password into a notepad file)
- Step 3b: Open the "PHPmyAdmin" in the cPanel. Find the database you just created on the left and click on it. Then "Import" the sql file you've saved later (in our case the
my_project_server.sql
).
So, the full & final step:
Final Step: From the File Manager, under public_html/
, Open the wp-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. :)