Updating wordpress child themes without deleting previous versions - php

I've built a wordpress child theme for a client and currently deploy each version as a manual .zip theme upload by having to rename each .zip file to a unique identifier (i.e. newtheme-2017-06-07.zip) and then deleting the previous version manually.
Is there a way to upload child themes via wordpress admin so that it overwrites any theme with the same name? I don't want to be going down the route of using FTP to manually overwrite the theme.
I'd also be keen to hear how the update API works so that a customer gets alerted in the admin section that an update is available. So far my searches have been particularly unsuccessful.
Any advice or pointers would be much appreciated!

Related

Is it possible to use WordPress theme preview as main website source that will work all functions?

I'm new in WordPress
I misunderstand one thing about the theme use in WordPress
For example, I wanna create the as same website as this I purchased this template.
But when I installed the theme in WordPress it shows me the default Index.php file with little info, used my purchased theme
And when I purchased the theme there exist all src files of the above website.
How I can use my purchased src files of website that will work all function for ex: logins with db?
Thanks in advance!!!!
After you purchased the theme, you probably have just installed the theme and haven't created any pages or tweaked any settings. So if you want to get the same look as that of the preview website, you probably have to check whether the developer has provided any dummy data for importing.
Most of the themes listed in ThemeForest would have the option to import dummy data, so that customers would be able to install some pre-made posts, pages, config, etc. This might be there inside the custom settings page(as a single button to download the content) of the theme, or maybe they have provided it in separate XML files for you to import. If the files you have downloaded doesn't have it, make sure you downloaded All files & documentation. Here's a sample screenshot:
My guess is that you might have only downloaded using the Installable WordPress file only option.
If you are still unable to get the dummy data, probably you have to ping the support of that theme asking them to provide the dummy data.

Wordpress theme update - how to not lose customisations on the parent theme?

Hoping someone experienced could share his knowledge and expertise on this. I was trying to find a good explanation on how to not lose customisations from my theme after an update, but I still cannot find a guide, without telling me to have a child theme before the customisations. However, I read them too late, and when hired freelancers, they have done the customisations on the parent theme files.
I am now running on a child theme, but, unfortunately, few of my customisations have been done before the move and they are still on the parent theme.
My thinking is can I:
"extract" locally my customisations,
update the theme,
copy back the customisations to the functions.php? (parent or child this time)
The extracting, can I do it: by comparing the code in e.g. Sourcetree: my customised parent functions.php with the original file I downloaded at the very start? (attached screenshot)enter image description here
When copying back the customisations - can I copy it to the child functions.php instead of the parent file?
What about customisations that have been done on different files other than functions.php and style.css - how can I find which other files have been altered in the parent files or know which one I should manually alter?
Will customisations on plugin files stay the same and not break the plugins after the update?
Thank you!
Here's one slightly crude/basic idea:
Create a repo/directory, add a copy of the original parent theme to it (at the same version of the one you modified (the whole theme, unmodified original copy)).
Now dump your modified parent theme in to the same directory. Agree to replace any existing files.
Now view the changes between each file via a GIT client such as Sourcetree or TowerApp
This will let you know what differences there are across all files.
Functions.php:
Now you can see which changes there are betweeen the original parent and your modified versions, you can copy function.php changes to your child-theme/functions.php file yes.

Is it bad practice to use version numbers in plugin folder names in Wordpress?

I have a Wordpress plugin that I don't want to release to the Wordpress store. Is there any issue in having the version of the plugin in the plugin folder itself?
For example, my plugin is called 'myplugin-1.3.3' and that is the folder that goes into wp-content/plugins.
This seems to be working well because it means that when I upgrade to a new version of this plugin, I can deactivate the old one and if there are any issues, I can re-enable the old one.
I have never seen anyone do anything like this so not sure if it is a bad practice. Previously when updating, I would take a copy of the plugin directory and move it outside of the wp-content/plugins directory so that if I needed to rollback, I could..however this usually means I need cPanel or FTP/SSH access.

Update WP theme without delete the old version first

I'm currently host my site with managed WP hosting (I have no access to my file directory). I use child theme that contains only style.css file (aimed to store the customization only) and I do not activate WP editor for security reason.
When I want to update my parent theme I should delete the old version first and my site automatically changes to other existing theme which is completely different.
To upload my new version theme it takes time about 1 minute and that means users will see my site with different theme while the uploading process.
My question:
How to update my theme without delete it first or is there a plugin I can use?
If there is no such a way, how to show error message ("Hey we'r currently customizing our site ...") during the uploading process?
Thanks.
if you are using the child theme then you can directly update as it does not effect your changes for child theme
and for showing maintenance there are many plugins that provides the maintenance mode functionality.one of theme is
https://wordpress.org/plugins/wp-maintenance-mode/
its show a template while you are in maintenance mode once done change deactivate the maintenance mode

Creating an Updates for Private WordPress themes

I've followed this tutorial for creating Private WordPress themes that check for updates
http://w-shadow.com/blog/2011/06/02/automatic-updates-for-commercial-themes/ everything is working fine. However I've hit a bit of problem with this method and wondered if there is a solution.
Because the function to check is in the themes functions.php it only runs if the theme is active meaning that the push notification do not work on multisite's network admin or if the theme is not currently being used.
Is there anyway to solve this?
You have 2 options:
Ship a plugin with the theme that is installed separately. Use this plugin to update your theme(s), that way your theme files will be updates regardless of whether it is active or not.
If you aren't distributing your theme publicly, and it's only used on your own sites then you could easily write your own cron task that runs the update script - but that depends on your situation

Categories