How to send only local Theme files onto live wordpress site? - wordpress

I had a live site onto my local server and made some changes in a static page of a custom theme. And now I want to push the edited files onto the live site. I surfed a bit on how to push local site theme onto live site but all answers were to sent whole site files and database replacing the current live site.
Is there anyway to sent only the Theme files onto the live site, a bit beginner friendly ?
As I haven't made any changes that might affect it's database I don't wanna replace everything in the live server.

By made some changes I guess you mean you edited one or more php files (or maybe css files) directly on your local site, then saved your edits, then hit refresh on a browser to see your changes.
That time-honored workflow is sometimes called hot-site editing. Your local site isn't very hot, but it is a live site.
You know which files you edited. So now it's time for the hot-site-patch workflow. Take the files you changed and drop them into your public site, patching the previous copies.
That's how you do it. Does it feel risky and error-prone? Like you could mess up the live site and annoy your site visitors? That's because it IS risky and error prone.
You say you don't want to copy the whole site. But that's the way your kind of changes are usually handled. There are plugins which help you rig up parallel staging and live sites. They usually have a big button marked "push staging to live" for when you're ready to do it.
Or you could put your custom theme in github or some other SaaS revision control system, and pull it live on your web server when you have changes to roll out.

Related

wordpress edit theme offline

I have a Wordpress-theme-based web published on the net, uploaded in a hosting.
I have to edit/simplify/modify the whole page, offline, on local for example.
While I make the changes offline, the page (an online magazine) has to keep online, as it is, until I publish the new version.
I have to be able to show the changes online, without affecting the original until the end.
What is a good way to do the whole process? Thank you very much.
Make offline server by installing eg. XAMPP.
Copy files, and export database from online to local,
Modify wp-config.php to match local database settings
Modify theme offline
Upload theme to online FTP when work is done
Make sure if changes you made are only in wp-content/themes/theme_name files - not in database content. If not, you will have to sync databases.
You can make the same to work online by cloning your WP to eg. subdomain, then protect it by htpasswd, to prevent unauthorised access.
I assume you mean with the same content?
One way is to make a copy of the main database (possibly refresh it now and then) for a second install online, with same plugins, settings etc.
Another way (bit riskier, but would give realtime sameness) would be to have a demo install on the same server that shares the same database: https://codex.wordpress.org/Editing_wp-config.php#table_prefix. I'd suggest with a custom user and usermeta where NO ONE has update privileges to avoid updates to the main site https://codex.wordpress.org/Editing_wp-config.php#Custom_User_and_Usermeta_Tables

Migrating client wp site for local development

I've been asked to help out with a former colleague of mine's Wordpress Site. Nothing crazy, just change the format of a page, and add some kind of form on another page. I'm not so concerned with these changes I need to make, but am more concerned with setting up an identical site locally so that I can exercise these changes, do whatever I need to do, then simply upload my changes.
Quick background of myself; web developer of about 5 years with strengths in the Javascript frameworks and Node sphere. I know what Wordpress is and can navigate through the project with relative ease. Where I fall short is uncertainty in the project set up side of things.
So I have both the project itself and an export of my clients database, and configuration is updated accordingly. When I attempt to run the site I'm constantly prompted with errors, most of which have me take a look at the code and see what exactly the problem is. At this point I've made quite a few adjustments to the site to try and make it work that I feel continuing development won't get me anywhere.
Is duplicating an existing site to a local env usually this difficult? Could bad implementation of the initial site by the previous developer be a reason why I'm now struggling? Am I missing a step?
Duplicating a WordPress website is not that difficult. If you have the wp admin login of your website then you can simply use duplicator or akeeba backup plugin, but no worries, if you do not have the wp login access and just have the wp files & db then try this: create a new db from phpmyadmin, place your files in wp theme directory, install your new wp by using your new db file created, after that import your db file and do the following changes in your wp config file found in your root directory.
You will need to type in the new database information: database name, database user, and the password.
Once you have updated those, click Save Changes
Fixing your Permalinks
Log into your WordPress Dashboard, using the username and password from the copy of WordPress you brought over
Under Settings, click Permalinks
You don't have to make any actual changes, just click the Save Changes button.
Doing this will update all the page and post URLs. If you have custom themes or plugins/widgets with old URLs, you will have to update those manually since there are not any plugins that are able to modify those as well.
For ref:
https://my.bluehost.com/cgi/help/2361
https://www.tipsandtricks-hq.com/how-to-easily-import-or-export-any-of-your-wordpress-database-content-using-phpmyadmin-3415

Overwrite existing Wordpress site on live server from local server

Still relatively new to Wordpress. I created a basic wordpress site for myself on a local XAMPP server. Using the Duplicator plugin I was able to move my local site to my live host with no problems. From everything I've read so far, the best practice for making changes to your website is to test on your local server and then make those same changes on your live site once you know it won't break anything.
My problem is that I'm planning on making lots of large changes and expanding my site a bit so I really don't want to do everything twice. What is the best way to download my live site back to my local, make my changes, and then upload them back to my live server?
Everything I've searched for in relation to this question is just how to use Duplicator to move your site to somewhere that doesn't already have a site installed, which in this case, I've got versions of the site on both my local and live servers already. Do I need to overwrite? Create a new folder and start over? I can do that on my local side, but not sure how that would work going back to live...
And as far as the database goes, is it better to overwrite or create a new one? I was able to just create everything new on the local side, new /test-site/ folder and new database, but I feel like that will get rather complicated if I try to move it back. Or should I just go ahead and make my changes live and hope everything works correctly and there won't be any issues like a newbie (even though I am a newb)?
I'm using Hostgator Cpanel on the live server side. And Windows 10, XAMPP on the local server.
Any help is greatly appreciated! The more simple directions the better. As well as any advice on workflow to set this type of thing up.
There is no big deal in editing your live site as long as you know what you're doing and you're keeping backups to date.
Anyway, if you want to go with what you have described above. Again, you don't need to download your live site again and again but make sure you don't do any changes on live site and so that your local site is always ahead of the live.
For me, an easy way is to use the All-in-One WP Migration plugin with which you can migrate from local to live within 5 minutes without the need to delete the current site, run the process like Duplicator does.

Restore wordpress from local copy

I have a local wordpress backup which is a copy of the main dir from the previous webhost.
I runned the site using wampserver but when I tried to open the index page it said: "Error establishing a database connection".
I think this is because the database is not imported in phpMyAdmin. How can I make this work so I can access the site?
The WordPress database stores all of the site content - Posts, Pages, custom post types, images, and so forth. Unless you have a copy of the database, the files you have will only be useful for setting up the same plugins and theme that were being used on the old host.
There may be a couple of ways to restore your lost content:
Check Wayback Machine - if it's a larger site it may be indexed here, and you can go through page by page and rebuild.
Check Google's cache - if the site was only recently removed from the old webhost, the individual pages may be cached for a time. It would be wise to download as "complete webpage" each page and then go through page by page and rebuild. Same with images - if they've only recently been removed, you may be able to find (possibly lower-resolution) cached versions and download them. To check, do a Google search for site:http://example.com (replace with your URL).
If neither of these exist, you'll need to start from scratch on the content, but you'll have learned a valuable lesson about backing up. :)

Duplicate an entire Wordpress site in the same domain

I have a live site built in Wordpress at www.site.com/name1.
The client wants a new theme. I've heavily modified the current theme with custom code and will need to do so with the new theme, all without interrupting the live site, so this wont be as simple as moving the site from one theme to another. Therefore I think I need to create a duplicate of the site at www.site.com/name2 because the content will all be the same. Doing this will give me a place to work on the redesign.
What is the best way to go about doing this? Should I have both use the same DB or not? When I get ready to go live should i simple redirect the domain to /name2 or move everything at /name2 to /name1?
Any help is appreciated.
Thanks,
Chris
If you want the same Data you can use the same DB but there is somes Options Tables dans Meta tables in the Wordpress DB, then if you change parameters on one site it will affect the other.
If you just recode the Theme without touching anything in the configuration you can use the same DB to test your theme with valid datas, but if you think you'll have to change paramaters i would prefer duplicate the Production DB to a Test DB to secure the production Website.
When you go live you'll just have to move your theme to the production website and copy your Option and Meta Tables.
If you're at a point where you're having clients, you should definitely develop locally. This will free you from the trouble of mistakingly messing up the production site.
Install Apache, MySQL and PHP on your own machine.
Copy database and files from production.
Change anything you'd like without exposing it to the Internet.
Upload your new, tailor-suited theme to production when it's ready to go live.

Resources