How to version control with WordPress - wordpress

I want to set up a system where a developer can work on a separate server on a wordpress website.
My question is: If in the meantime changes are made to the live site (like plugin updates, new plugins, new posts, new comments, etc), how is one able to import a new feature (e.g. a new page) from the development server on the live site while making sure that previous changes on the live site don't get deleted?
I am looking to understand how this all works. In a sense, I would like to have some kind of version control system.
Thanks in advance :)

You can version control your own code using git. Basically we would init a new git repo and commit changes onto this repository. This can lie separately outside of the core files. i.e you only need to include the wp-content directory and ignore all the other core wordpress files.
Here is a good article on how to do a really good versioning system for a website.
http://toroid.org/git-website-howto
The posts and pages (basically content) in a wordpress site however lies in the database.Any changes made there will be permanent.
The only option is to keep taking regular backups of the content. You can do this by using an automated backup tool.
If you really want to version control your database, here is an article that helps:
https://blog.codinghorror.com/get-your-database-under-version-control/

This one is a tricky one. You cant host a single website on two servers. Just imagine a website having 2 hosted urls..!! No way.. You can never do that.
You better create a new user and give access to him. Look carefully in the settings and be a admin. You will have a chance to approve or reject what the second user changes.
Hope this helps.

Related

When i visit first time on wordpress website, its open another website automatically on first click

When I visit first time on WordPress website, its open another website automatically on first click anywhere, I don't know why its showing this strong text
Of course, it is better to have more details. But if this happened without any actions from your side, I would agree with Michela - it could be some malware on your website.
If you don't know what's going on under the hood, it is hard to cleanup the website completely.
As a first action, I can recommend you to check if your hosting provider have any backups for the website. It is possible that you will be able to restore to the point when the website was clean.
To clean the website by yourself, you can use various Malware Scanner plugins, like Wordfence or other specific. They can check for changes inside Wordpress core or standard repositories + they can check for strange, vulnerable and malicious parts of code. But be careful - if you have some custom code, it is better to check it with the code author.
If you'll be able to cleanup the website, I will highly recommend to go harden the website security. Some classic recommendations may be found in the official documentation - https://wordpress.org/support/article/hardening-wordpress/.

Building a website for a hotel - is WordPress the best idea?

I'm researching to see if building a full website for a hotel be a good idea to do on WordPress.
I read that wordpress is okay but there are better options.
I want to design and code my own front end look to the website, but have the backend on a stable platform that can take all the reservations seamlessly.
My main concern is to be able to have a backup of all the files and easily switch to another server in case something goes wrong.
I can host the website on my server or host with the service you suggest that comes with the platform all together.
Any ideas and/or suggestions are greatly appreciated!
There are other options, no doubt, but yes, it can and is really possible to build it using WordPress as CMS.
If you want to design and code your own theme, you'll need to study the WordPress Theme Structure and, since you'll build it by yourself, you'll also need to develop plugins to create custom post types (aka CPT) to make the hotel management easier on the WP back-end.
About the theme structure, files, child themes and everything, I'd recommend you to read https://codex.wordpress.org/Theme_Development
About the plugins development: https://developer.wordpress.org/plugins/
About Custom Post Types: https://developer.wordpress.org/plugins/post-types/registering-custom-post-types/
About the backup: it's super easy and you can even make a full backup using free plugins via back-end. But if the site goes down you can easily do it via FTP downloading only wp-content folder and the database. It's really simple to migrate from one WordPress to another, or from host to host.
About the hosting, you'll need to use a server if you want to build this project. There's a difference between wordpress.com and wordpress.org
The .com is simpler, you are not able to build everything you want. The .org is the open source project, which you get the files, upload to your server and connect to database (MariaDB or MySQL). Most hosts offer automatic installation for WordPress and, from there, you can change whatever you want and need.
Note: many developers create CPTs INSIDE the theme's code, but this is not recommended by WP as you can see in We recommend that you put custom post types in a plugin rather than a theme. This ensures that user content remains portable even if they change their theme.
WP is not really hard, after 1 week studying you'll see yourself getting over most difficulties. Even if it takes longer, don't give up. There's a huge community to help you with WP questions.
Hope it helps and I'm sorry my bad writing, I'm not an english native speaker.
C ya

How to keep backup or save latest WordPress build in Github

I am making a WordPress website and I might create new builds. How will I keep back up or save my latest builds, I would prefer to use and manage builds through github. Is there a particular way that I can do it in WordPress?
Simple way to install this plugin and create your WordPress backup and download it :
https://wordpress.org/plugins/duplicator/
I used gitwatch to automatically commit new code to a Github repository. This included new uploads and new plugins. Just follow the ReadMe and it works pretty well.
This is an example of a website where I used this technique.
Words of Caution
Use .gitignore to exclude your wp-config.php file so that database credentials etc are not stored to github.
Be careful not to dump your database to the wordpress directly (which
would automatically commit it to Github).
Be careful of plugins
that write sensitive stuff to a file that might get committed.
I am aware of Kerchoff's law, or not attempting security through
obscurity, but I am not stupid about the risks of automatically
publishing all of your configuration publicly. The site above is not
a high profile complex site (and I generally like to think I know
what I'm doing). DO NOT do this at home if your website is handling
sensitive information or could be at risk of anything more targeted
than a general Wordpress security flaw dragnet on Google.
One partial solution to these concerns would be to just make the Git repository private.
Finally if you are dealing with European data you need to comply with GDPR
which means you need to be ready to scrub a file from Git history
using something like BFG
You are addressing two different things. For backups, there are WordPress backup plugins that you can use like updraft (here's the link: https://wordpress.org/plugins/updraftplus/). But when it comes to development workflow then GitHub is the right platform. If you want to know how to work in a live environment and how to push and pull the latest changes from local to live or vice versa
(to keep track) then this guide will help you. https://www.cloudways.com/blog/wordpress-github/

Managing Multiple Wordpress Sites

Not sure if this is the right place to ask, sorry if its not. I build a lot of Wordpress sites. My problem is, the number of them is getting big and harder to update them all when new releases come out.
I have written an app that will download the latest Wordpress release, and manually ftp the new files to all the clients, but this takes forever... need a new way.
I wanted to restructure this while I can or start a new process at least. Whats the best way to manage multiple Wordpress sites and keep them all updated? Some people have said 1 DB and modded config, others I have seen said to keep all installs separate and use plugins to automatically upgrade, but I don't know whats best to do. Ideas? Thanks :)
If these were all sites you managed on your own server, I'd recommend using a Multisite installation rather than separate instances of WordPress. This way you only have one set of themes, one set of plug-ins, and one copy of WordPress to maintain.
If these sites are on different servers (i.e. you're maintaining sites for clients remotely), I'd recommend you look in to a beta account with WP Remote. This is a service specifically built to allow you to remotely monitor and update multiple WordPress installations. It might be the best solution for you because it allows you to use the one-click update rather than manually downloading/FTP-ing the new files.
You can use this free self hosted app http://infinitewp.com
No limitation in number of sites being managed. You can update WP/plugin/themes, do backups, one click login to your WordPress admin panel.
EAMann is right, especially with the new Multi Site features in Wordpress 3.0, there is no better way to manage multiple sites under one umbrella. Being a developer myself, I know the pain of having to login to all those different accounts!
The way to set it up is create a "master domain name" that you will log into. Place this in your WP Config:
define('WP_ALLOW_MULTISITE', true);
Then login to your admin panel, navigate to TOOLS>Network.
After you've set everything up, copy/paste what it tells you to your HTAccess and WP Config file.
The next step, especially if you are putting clients on this network, is they will want their own domain name, not AIBot.com/theirname right? Thats where Domain Mapping comes in:
http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/
Check that out and good luck!
What you need is www.managewp.com it can do all of that for you plus a ton of other excellent features.

new wordpress design over an existing complicated one?

Hey folks, I got a project from a firm program out a Wordpress design. 80% into it I learn that the client already have an existing one, a robust one, with subsrciptions, blogs, forums, newsletter mailers and so on. Turns out there is a discrepancy bettweent design and old wp structure which I will work on resolving.
I have been developing in on my own server for the time being.
At this point I am not clear on what the strategy should be.
1.) Export out the current wp site out to a different server, duplicate it and then reskin/rework the frame work.
2.) The firms hope was that I would be able to go in and add a new theme, but am not convinced that doing this live will be a good idea since I am using a different theme so all the hooks will be different then the current one.
3.) There is already a large amount of users etc that have signed up to the existing newletter, forum etc. Not sure how to carry this forward?
Any insights are greatly appreciated.
Definitely make a copy of the existing environment. Check it into a version control system (if it's not already the case) and work on that.
Try to put all your work into a new theme: That will make installing the changes on the production server super-easy.
Be careful about any notifications and pings that your development copy may send to the outside world. Be especially careful about the newsletter.

Resources