Wordpress lost link after theme update. [Enfold Theme] - php

I'm by no means a coder or programmer but i have enough to understand my part and fix small issues or adjust look with basic CSS, and so friend of mine asked me for help and here i am two days later asking you)
There is a Website running Enfold theme which recently were updated and so was lost custom image link at right part of header made by someone-else.
I have restored link code from Cached version of website but have no real understanding how and where to add it back to theme templates. Would appreciate any help, solution, link, advice.
Cheers.

A wild guess, since I don't have Enfold theme (the best would be to ask on the official support), but in your div #header_main in the .inner-container, you had after the #advanced_menu_toggle this piece of code:
<img src="http://vcmt.ca/wp-content/themes/enfold/images/layout/canvas.jpg" alt="canvas" style="max-height:70px;">
Just open the .php file that has the header in it, and paste this code back in. Since the canvas.jpg was located in the /images folder of the theme, that is also gone, so my recommendation is to download the image from the cached version if you can and put it back in the image folder.
Also it would be better to make changes to child theme, so that you can update the functionality of the theme, without loosing any custom added modification, like this site had.

If you're planning on changing the CSS in any WordPress Theme, you want to make sure that you have a child theme installed. The child theme allows you to change/overwrite the CSS and Theme Functions on the theme without losing those changes everytime the theme updates.
You can download the Enfold Child Theme Here:
https://kriesi.at/documentation/enfold/how-to-install-enfold-theme/#why-child-theme
...and if you need to add HTML to the header, you can do so by duplicating the header file from the theme, adding a header file to the child theme, and making your changes in the child theme header file.
Hope this Helps!

Related

WordPress /wp-inlcludes/functions.php: Custom functions/code disappears

I have added two custom written functions to my wordpress code.
One of them uses the add_action() and the other uses the add_filter() function of wordpress.
After deploying the code, both functions work as expected, but after some time (I am not sure how long it takes and what causes wordpress to do so) the code just magically disappears from the file.
I am now wondering
Why is this happening?
What can I do so that this won't happen again?
Thanks for your help
Hey you just mentioned that you've added code into /wp-includes/functions.php file. You've used action and filters that's good but your code should be go into active theme's (child theme is the best practice) functions.php file. Files under /wp-admin/ and /wp-includes/ get updated automatically from WP when new update is available (based on settings you have done on your WP setup you can ignore updates as well).
So, your code must be removed by update. Files were overridden by updates. If you have backup copy those code and put it into active theme's functions.php file /wp-content/themes/yourtheme/functions.php is the correct file where you can add the code.
If you have added code into theme's functions.php file make sure you didn't get theme updated otherwise you may lost your work as well that's the reason you can use the Child theme. You can learn how to create child theme here: https://developer.wordpress.org/themes/advanced-topics/child-themes/
Why is this happening?
Most probably because someone updated WordPress to latest version. Before you are going to tell me "but I did not press anything, ever!" please bear in mind, that WordPress updates itself automatically. Especially in the newer versions.
Here is nice article about WordPress automatic updates. It also describes how to turn this off, but I do not recommend doing so.
What can I do so that this won't happen again?
Develop custom WordPress plugin, containing your customizations. Here is nice step by step tutorial
you shouldn't make any changes into wp-includes and wp-admin folders, these folders will update automatically if your wordpress is updated. so if you want to make any changes using hooks and actions you can place the code into your current theme's functions.php. that will work as expected and your code won't disappear.

How can I import my custom CSS and HTML into Wordpress? And how do I prevent updates from erasing my code?

Summary: Question 1. How do I import css and html into Wordpress? Question 2. How do I protect it from being erased by a Wordpress theme update?
3. Is there an alternative that allows me to publish my code the way it is without a CMS, and if so what is it?
I built a website layout in my text editor using just HTML and CSS for a client. Her website is under 10 pages. Now I need to import this code into her CMS/website builder, Wordpress. How do I do this while protecting it from being deleted by Wordpress theme updates?
How to get code in wordpress:
In your theme files, there are the header.php, page.php, single.php, archive.php, footer.php, which are parts of your wordpress site. If you past your code in here, the pages where the theme files are used (for example the header and footer is used everywhere in the frontend in most themes), will include your code.
How to prevent being overwritten:
You can create a child theme of your theme. This way, it uses the files from the parent theme, but if you put a file with the same name in the folder of the activated child theme, it uses this instead of the file of the parent theme.
This way your changes will not be overwritten, when there is an update being installed at the parent theme.
This may be a good tutorial https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/
Publish your code in the internet
You can use a webhost (there are thousends) or a repository. There are also free alternatives. Webhosting should bring you answers.

How to customize wordpress theme, include widgets?

I have a new site with a Wordpress theme (and I failed to find any information about the theme). The theme have all the features I need - forms, sliders, google map widget and others. But I see no tools to change them, except manually editing theme's php files (I've already done child theme). I can do it, but I'm doubt if this is the right way to create sites with Wordpress?
Please give me a hint, what should I do - edit php files, create new menus and content pages (which already are in theme) or maybe something else?
PS: sorry for possible stupid or duplicated question in advance.
I normaly edit the themes by changing the php files.
U can use a plugin for editing your themes. I use this one https://nl.wordpress.org/plugins/theme-editor/.

How to change custom HTML in wordpress

I need to rewrite some code on my client's website that I haven't made. The problem is that it runs on wordpress (w/ a customised theme I guess) that I've absolutely no experience with whatsoever.
Where do I find the source code made by that previous developer? I tried to find it in the "wp-admin" page but I failed :D ... where would you edit website's landing page?
Thanks ;)
Depending if the developer wrote a new theme or edited another theme, and if the lather, wether he did it the right way.
Check out the name of your current active theme and you should find it here:
/path/to/your/wordpress/installation/wp-content/themes
If he altered another theme, there should be another directory named "activeTheme-child". There any changes should be made so you can run updates on the main theme.

How create a Wordpress template through a HTML/CSS page?

I would like to learn about wordpress.
Is possible to create a wordpress template through a HTML/CSS page ?
I'm taking an easy HTML page to start, so I install the XAMPP and then the lastest Wordpress.
Any help is very welcome.
Thank you very much.
ps: I'm searching something in Google though.
I'd recommend learning a bit of PHP since it really helps making your way around Wordpress files. Makes life a lot easier even if you're mainly editing HMTL/CSS.
Install Wordpress
Copy the defaut theme folder (twenty elevent) inside /wp-content/themes
Rename the folder to your theme
Open style.css inside it and change meta information in the header file
Edit away the php/style sheets as you like to modify the theme to match your style
header.php - contains the common header code, usually navigation etc (Edit everything but dont remove wp_header. You will need that tag for wordpress to work, same for wp_footer in footer.php)
index.php is the main content file, sidebar.php is the sidebar
But you can use all these files as you please, its normal php/mysql stuff.
This is very useful too - http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

Categories