Wordpress theme reverted back automatically - wordpress

I have theme Sydney by ATHEMES activated on my Wordpress site http://www.hamrolagi.com, and edited the theme files without making a child theme. I had edited the header.php, template-tags.php and other templates files according to the customization requirement. It was working fine until yesterday, but today I see that the edits I had made to the files were reverted, and though the site is still functioning, the customizations are lost, except that to the template-tags.php, which is the only file I had edited which was not in the main theme directory. I had backed up the edited files. So, I was able to re-edit them, but I wanted to know what caused it and how to prevent it in future?

I'm pretty sure it was a theme update. Always use child themes - that is by far the only sure way to prevent it from happening in the future.

Related

How can I permanently fix an issue caused by a wordpress plugin?

I am using the plugin Photo Gallery on my WP site and have a CSS issue with it. Before the gallery is displayed correctly, it is displayed for a split second in a different way.
From what I found out, this is apparently a "FOUC" (Flash of unstyled content) and caused by the plugin's CSS file being loaded too late.
Now I was able to fix it by adding a CSS class (.invisible) to the whole gallery in the plugins php code and setting that class in the wordpress style.css to "display: none;".
In my themes JS I then check if there is a photo gallery on the page and once the according CSS file is loaded, I remove the .invisible class from the gallery, so it is displayed correctly.
I am aware that this is not really a good solution, as the next plugin update will break it.
So my question is: What is a better way to fix an issue like this?
Probably the best bet would be to reach out in the support forums and let the plugin authors know that there is a problem. You already have a working fix for that problem so don't hestitate to show them your solution (but i dont think that hiding the slider is a good solution).
All plugins in the WordPress plugin repository have a support forum on wordpress.org … many plugins also have own websites with some kind of support mechanism (forum, contact form …).
Another solution would be to place the code that fixes the plugin not in the plugin folder itself but in you theme/child theme or a own plugin …

Code reverts back to original theme after a while

Apologies for such an amateur question, I can't find the answer anywhere else after searching.
I have a pre-installed theme on WordPress for which I have used an SFTP to make minor code changes to my site. Just little things like changing the hardcoded footer text, the CSS and a slight tweak to a php file, that all worked perfectly. However, this is the 3rd time I have had to make these same changes because I will log in one day and all my changes have disappeared without me doing anything. It just reverts back to the original theme.
Why could this be?
I don't have a child theme which I know I should sort out, but could not having a child theme be the reason it reverts back?
Thanks in advance.
You're most likely modifying a theme that gets updated automatically. Your changes get overwritten by the updated official version. If you want to keep your changes, you'll have to use a child theme or make a plugin, depending on what kind of changes you want to make.

Style.css mysteriously turned into one line

I'm developing a site using the Divi WP theme, using a child theme. I had a style.css that I was working with in Sublime Text 2.
After making a change and reloading the css, it all got turned into one line, instead of being multiple lines down the page. I can unminify using a tool online and a bunch of manual editing, but I'm afraid this will happen again.
There are no "automatic" minifying plugins in use or any other thing that should cause this.
I've never had this happen before.
What can I do to keep it from happening again?
Thanks.

Wordpress site deletes the edits I made

I would need some help with my Wordpress site.
I made a lot of change in my theme (one-page-express):
added some plugins and edited the code as well (I only edited header.php, header-homepage.php, footer.php and style.css).
For a while everything looks okay but then after a few hours it seems to auto delete the changes I made in the editor.
Keeps the new plugins and its edits though, but all the code gets restored to default.
Anyone has any idea why is it happening and how could I fix it?
I learnt coding/Wordpress by myself so I might have missed some crucial point, I don’t know.
Thanks anyone who can help me!
First, try to desactive yours plugins one by one and check if you have something new. And be sure to have correctly crushed your old files (In you FTP manager, you can see the last date of editting a file, don't miss something ;))
NEVER make changes in an existing theme if you want them to persist. Use a child theme to do so. I guess you pressed the update button (as you should). Updating a theme will remove/delete the current theme (all files) and download the latest version. This might look and feel like 'auto-delete'.
Source: https://codex.wordpress.org/Child_Themes

what will happen in my website when i changed the current theme with new one?

1) Can i change the theme of wordpress in this site
www.lenews.info
with this,
http://quanticalabs.com/wp_themes/pressroom/home-style-6/
2)if i do it i lost something of image article format etc??
i need to change the theme but i don't know if i do it, what happen in the site
3) if i change the template? i want the same format of plugin and component, can anyone help me with this?
Presently I am using a wordpress theme.
I want to change it to something better. But I am afraid, if I change
the theme,
I will lose all my contents that includes Posts, Pictures,
Categories, Tags.
I am not at all aware of this fact. Need some help.
Tell me if what I am afraid of is really going to happen if I change or not.
What are the pre-steps that I can take to keep all my contents uploaded the same way they were before.
I already have a daily backup system using WP Backup plugin.What else?
Please help!
Good habit is backup before do changes.
Checklist: 6 Things You MUST DO Before Changing WordPress Themes
Take Notes on Your Current Theme
Go through your theme files and note down all additional code that you added. You also want to check your current theme’s load time because this way you can compare the two. Go to a site like Pingdom Tools or use YSlow to test out different pages (Yes different pages, not just the homepage).
Be cautious of the Sidebars
If you are using a widget-enabled theme, and you switch to a theme that is not widget-ready, then you will lose all of that. If you are using a widget-enabled WordPress theme, then this is not an issue.
Also anything that you modify in sidebar.php file of your old theme, will be overwritten. So make sure that you add those codes in the new theme sidebar.
Backup!!
You never have anything to lose by creating a backup. As a precautionary measure, you should backup all of your theme files, plugins, and the database.
4.Testing all functionality and plugins
Once you have the new theme activated, you need to make sure that you retain all the functionality and plugins still work. Try out all the features including but not limited to the commenting process, single post pages, search, 404 page, archive page, contact page etc. Make sure all of your widgets are still there and are working.
Cross Browser Compatibility
Test your site in all browsers you have access to. Browsers have a tendency of rendering things differently.
Maintenance Mode
You probably don’t want your users to see while you are making the switch because they will end up seeing a broken site or such. It is best to turn on Maintenance mode for 15 – 20 minutes that it may take you to make sure that everything is working properly. Once you have setup Maintenance mode, you are good to go ahead and activate the new theme.

Resources