At some point during the lifetime of your WordPress site, you will have to edit it. You may need to make a few tweaks, or overhaul it entirely. Whether you like it or not, this is an activity that you may need to face a few times.
One of the reasons you may have for doing some edit on your codes might include adding some new features to your site. Or it could also be for the re-creation of the whole theme of your page.
These are just among the many possible reasons on why you need to deal with the change on the codes of your website could occur. That said, it’s best that you’re prepared.
But before you get all excited about technical things of coding, you also must be aware of the many crucial things that you need to know when coding in WordPress. Buckle up because you’re in for a good “coding ride” with this article.
Before anything else, you must remember: Never dare to try and hack the WordPress system, which is best known as its core.
Those who have been working with WordPress for the longest time now know this rule. You must never touch the files and everything that pretty much makes up the entire system of WordPress.
And you might be wondering why you shouldn’t do it. The plethora of reasons might be endless if we may put it that way, but here are the major ones that you should take a look at.
Why You Should Not Hack the Core of Your WordPress Site
- If you hack the WordPress core, the chances are higher that your website wont’ be future-proof. It means that doing some updates and maintaining those changes will no longer be available for you.
It’s like doing an upgrade. Once you have upgraded to a new update, you lose all the outdated things you have on your site. Everything that you customized will be overwritten due to the updates that brought all that changes. It’s going to be a complete waste of time to read all the things you customized each time you upgrade. This is exactly what happens when you play with the core of WordPress.
- In case you’re not aware, but there’s already a plugin built to make changes in everything that WordPress does. You don’t have to go through all the trouble that hacking could give you. You can legitimately just use a plugin to make some changes without having to jeopardize the entire future of your website.
Now that you know why you shouldn’t hack the system of WordPress, it’s about time that you become aware of the things that you can alter. And go about knowing more about the things you can probably recreate without harming its core.
Let’s Talk about the WordPress File Structure
In this section you can see a picture of a typical WordPress installation file structure.
You will notice three folders here that are top-level along with different kinds of files.
If you see the folders that have the labels WP-ADMIN and WP-INCLUDE, whatever you do, remember this warning to not open it! Tell yourself that you got no business touching those folders anyway. It has your themes and plugins by the way because we know by now that you’re curious about it.
All the photos of works uploaded on the website are also found on the WP-CONTENT folder. Don’t customize or change anything using these folders because you the have function.php file for you to play with.
Out of the forbidden files on the top-level folders, there is one that you could open and that’s the WP-CONFIG.PH file. You will learn how to edit this folder as you but for now, you must focus on the dos and don’ts in te world of customizing WordPress.
Guidelines on Editing WordPress Folders and Its Contents
Changing your theme and plugin in WordPress is possible because it is included in its core’s function. Here is the direction on how you can see it in your system.
First go to Appearance followed by going to the Editor that is seen on your sidebar.
The truth is you can really just look at it because there is no way you should use that feature at all unless you want to damage your website. You can explore it but again, NEVER make any changes in it. As much as it is tempting to do anything with it, don’t. Here are more reasons why it is a bad idea to go through with it.
- Although this file is called the “editor,” believe it or not, it doesn’t really function as one when it comes to handling codes. You will just find yourself making mistakes with it and the next thing you know, everything you have worked for is gone just like that.
- You cannot undo things in this file, especially the moment the save button is pressed. You could only wish that a time machine exists once you have made changes with it. The usual code editor will allow you to actually make changes to do it all over again, it will be so wrong to assume that it will do the same thing.
Here’s the catch: should you want to get your hands on a code editor, you must learn the ins and outs of FTP (File Transfer Protocol).
Files are transferred to your web server when you use FTP. It’s a must to do anyway if you are trying to get some serious with your site. In order for this to work, an FTP client is required. You must also download a copy of the file that you want to edit, followed by uploading it again to the server, which will replace the file that is originally in there.
There are files that you could make changes from the server itself like using “ñ Coda”. While others would also allow you to preview those edits that you did like with HTML and CSS code editor.
How to Edit WordPress Files
Okay, this is it! The process that you’ve all been waiting for and it’s none other than code editing.
On this part of the article, you will see some samples of code editing from the files WP-CONFIG.PHP and FUNCTIONS.PHP. These are the files that you are most likely to touch.
How to Edit a wp-config.php File
First you must know that this file is among the crucial files in WordPress. You won’t see it as a default file in there because you’ll have to manually install it. You can already start your work on this file the minute you install it. The job is more on adding database manually.
Creating this file is actually a piece of cake, knowing that you already did it once you have placed all the database info during its installation session. Let’s try to make some edits now.
Ever since WordPress released the 3.7 version, auto updates were always included in its system. Only a few are probably fond of it because most most people would just choose to have this off. If you don’t want this part of your WordPress system, then just do have this commands and you’re set:
- /* Disable WordPress automatic updates */
- define( ‘WP_AUTO_UPDATE_CORE’, false );
To avoid cluttered codes in your files, organize them and place them in a folder or somewhere you won’t have a hard time looking for them. Saving a file is also something you should keep it mind, don’t forget to do it whenever you add new codes or delete characters before leaving.
How To Edit the functions.php File
If you want to edit the default settings in WordPress, this is the file that you will be messing with. It works almost like that of a plugin because it lets you make changes in terms of the system’s features and functions that will contribute a lot to your website.
This file is often seen inside a folder for themes, but that’s not usually the case because sometimes you will have to create it manually. Don’t worry because it’s not that hard.
The knowledge on knowing PHP to make changes in this file is a must. Opening a script is involved here, so you better get some refresher on your PHP basics.
If you want to add some functions to this file, here are some examples on how you could do it. Rejoice because today you’ll learn not just adding features and functions, but even how to properly code to add it in your theme is here.
TIP: Use a child theme for the most part (especially if you’re a beginner) because it’s way easier to edit with that.
Here is to how to code this file if you want to thumbnails to be added on your theme:
add_theme_support( ‘post-thumbnails’);
Here is the code if you want an exact location for your thumbnail
<?phpthe_post_thumbnail(); ?>
The length of excerpt in WordPress is a bit limited to only 5 words. But don’t fret, because you could adjust that according to how to want it by using this code:
//custom excerpt length function custom_excerpt_length($length) { return 20; } add_filter(‘excerpt_length’, ‘custom_excerpt_length’);
Now that you know all this, make sure that you do the right thing whenever you work with WordPress.
How To Edit WordPress Themes
It’s safe to say that whether you like it or not, editing your website, especially if you’re using WordPress is something that will be not optional. It must be done because change is inevitable. The theme of your files that is usually set on child will later on have to undergo some changes for the benefit of your website as well.
It could be the color that you want to edit or the templates that you need to format and add. But whatever it is, you must know that there are so many ways to make some changes within your files that deal with the theme of your site.
Plugins that handle the editing of your WordPress theme are your best friends in this task. The good news is there are a lot and among them are WP Editor and Jetpack Custom CSS just to name a few. If you don’t feel like using some plugins and you want to edit on the files themselves, just go to Appearance and hit Editor.
You’ll see there that you’ll be able to access the file editing directly without other mediators. Fair warning, without the right plugins editing WordPress, it would make your project vulnerable to errors and the next thing you know, all your codes are gone. Yes, it happens so might as well don’t go to the Editor at all if you can’t handle it.
It is going to cause a lot of chaos on your end should you end up having a blank screen because you made a mistake. You are only human and you are bound to not be perfect. It’s best to have a backup plan or rather a tool that will enable you to correct your errors and the Editor is definitely not a safe place for that.
The file that you lost must be replaced by another file using FTP. If you’re not well versed with FTP, then it’s a whole new drama that I can’t help you with. What’s the best thing to do you ask? Well, on that one, I got you covered.
First, I suggest that you use the Custom CSS theme editor for adding new styles on your website. This can be done directly on the plugin and unlike the WP Editor; you won’t have to worry about losing your codes and files here.
You can research on more CSS plugins for the safety of your work and at the same time. It will also be handy to do more researches to find a reliable way to make some changes on the style and design of your theme.
Among the many plugins the deals with editing colors and other styles, Jetpack is something I could recommend. WordPress is the system behind and it’s among the user-friendly plugins out there, so it’s perfect for newbies. Install it just like how you do it with any other plugins. Just go to your Dashboard and find Plugins.
From there, you can see the “Add New” section and you can already install it and even activate it from there. Note that you can also delete all the changes you made by simply removing the code you place then hit the Save Stylesheet command. This is by far among the safest way to make changes on WordPress. And as I have mentioned earlier, it’s also very easy that you won’t even need a Computer Science degree to figure it out.
Editing Theme Functions Using Snippets of Codes
Thanks to Shea Bunge Code for creating “Code Snippets,” a brilliant plugin that makes website owners and coders’ lives easier. This plugin is genius because you can segregate functions with it.
You can easily activate the plugin and even deactivate it if you want and you can do that separately. If it’s your first time to deal with all these, it’s not going to be a problem because it’s meant for those who are amateurs in the world of WordPress and coding.
Exporting the snippets is also possible whenever you want to edit your website’s theme. Again, this is way safe than having to edit using the function file. It is going to be a wise move on your end if you value all the codes you have placed in your system.
TIP: It’s always best to have a saved file of your theme separately because you’ll never know what could happen in there. At least you have everything copied and can always encode them whenever you need it. Make sure that all your FTP details are saved as well and you know where to always find them.
Your CSS is what usually makes up the entire image of your website and you must be aware that coding it wrong could actually make WordPress useless.
Keep in mind that this plugin Code Snippets is almost like you’re just creating a new post on WordPress. It is easy yes, but it’s not exactly like that.
Moreover, I know that you’re going to have a lot of editing to do still especially when it comes to the topic of making changes with your theme including its templates. And here I’m about to give you the final plugin to use.
Editing With WP Editor
This is not to be mistaken as the Editor on your Function File by the way. This one is found on Appearance then Editor and it’s formerly known as the WordPress Editor. This one has an undo button where you can make changes if you made an error. Should you want to deactivate this plugin, you can always do that but just make sure that you are NOT using it.
It is only hard to edit WordPress at first. But once you get the flow and you have been familiar with the codes and the plugins that you need to make it happen, the rest will be a walk in the park. Don’t let coding and the technical things intimidate you, instead let them just be a challenge that you could overcome.
The Basics on Editing WordPress Themes
Now lets talk about some basic editing on how you could make changes on child themes and the contents of its structure. You will also be able to have an understanding on the ways of importing styles of the Parent Theme CSS.
Overriding the said styles and template files of the Parent Theme are also among the things that you will discover here, as you continue on with this tutorial. You will realize how easy all these tasks are and it will completely change how you see WordPress and how its themes are developed.
So Let’s Talk About The Child Theme Structure
You can locate these themes on the content area of the WordPress. The admin section of the program is where you can activate this theme. When it comes to the style, the “style.css” file is its default and could even have some “functions.php” file in them. From those files, you might see some folders that are really crucial for the system. Bottomline is, they are the same with the WordPress themes.
The only difference that the Child Theme has from all the other themes on WordPress is the fact that you don’t need to have any knowledge of PHP at all.This just made all your job easier by ten times, in case you don’t know.
Child Theme’s Stylesheet and Its Comment Box
In order to know how this theme works, you must have an idea on how the file style.css functions. Being specific on the templates that you will use is a must to gain access on making changes on your theme. It could be confusing at first, but allow me to explain further. It’s actually simple because all you must do is to change the directory name to “Parent Theme.” And seriously, that is it! You are now ready to edit!
Knowing The Best Framework for Your Website’s CSS
I know you’re dying to see an example on how to pick a framework with the Child Theme and how to edit the theme itself into your desired one. You must know that this might not be challenging at all, so that’s some good news! Let’s take a popular theme in WordPress called the Fusion and let’s change it to Love.
The first thing that you should do is to create a proper directory that is labeled. This is basically how you should name it:
/wp-content/themes/fission/
From that directory, it’s now time make another file named style.css. Open that plugin using the text editor on your computer.
Just put the characters /* in the beginning of the command and insert the theme name of your chose, its description and it’s original template, then end the code wih */.
Once you’re done creating a new child theme, you can now activate Love using the Themes part of the admin page. You know you’ve done everything right if it actually looks wrong. I know, the irony. But trust me, that’s how it is. On your browser, it would appear like a new and legit HTML file that is completely raw.
It won’t have so many stuff that you expect on it, but if you get to look back on the backend of any CSS design, you will realize that manipulating the divs and other elements on it would make up a new design.
Once you have figured the above out, I could pretty much assume that you’re ready to manipulate the heavy-coding world of HTML. You must know that you’re about dive into WordPress and its PHP files. It sounds hard, but it’s really easy.
If you’re new to this task, you should know that you actually created a black theme from WordPress that actually functions. From the directions I gave you a while ago, you may have not noticed it, but you actually did it by just doing some some CSS coding and even HTML without having to manipulate things with PHP. You can recycle those codes I told you whenever you need it and just save them in case you want to make some changes in your theme.
It’s Now Time To Import The Parent Theme Styles
So the whole screen doesn’t look right to your eyes after changing a new theme from the original child theme. The best way to make it a little bit right (at least on how it looks) is to incorporate CSS. There’s really no way around it, but this. From the five lines you made a while ago for creating a new directory name, you will just need to add one more line and this time after the characters */ you will have to add this:
@import url(../fusion/style.css);
Notice that it will turn out to like just like Fusion, which is the original Parent Theme. I’d like to call it a miracle on how codes could make drastic changes with those simple characters from our keyboards.
You should know that you just made a space that is safe to make edits on the Parent Theme without having to manage the files from the original theme. It’s all about working safely on WordPress really. If you know how to do that, then it’s going to be an easy ride for you and your website creation.
These are just a few of the plethora of things that you could do with WordPress. It’s a lot easier to manipulate the back end of the system if you know the basics of WordPress itself and the codings that you need to be familiar with.
For some, they think that you must be a complete genius to figure out working on the system of WordPress or you must have a degree to pull off creating designs for their websites. I say just be resourceful enough and you’ll be able to figure it out just like most of the geniuses that we know.
6 Things to Remember When Editing WordPress Themes
If you are new to WordPress, don’t be intimidated about the whole setup and process of editing its system to give you a cool and functioning webpage. Don’t believe it when they say that you’ll have a massive headache before you could figure out how to edit and customize your themes in WordPress.
Trust me when I say that it’s not going to be a pain, especially once you have been familiar with the system. This is a tutorial for all the newbies out there and I made it sure that everything here would be easy for you to grasp. Read on and be excited!
But I have to be straight to you that you at least must have some background doing HTML and some basic idea on how CSS function. If you already know it and the only problem is that you’re not well-versed on how the themes in WordPress actually works, then this article could be of help to your current need.
It doesn’t really matter if you’ve been coding and programming for the longest time, you will learn you will always discover something new that you could get everyday and in every research that you do. It is all a learning process, be excited in the things that you’re about to discover today.
But before anything else, it’s a must that you know the things that you must do and not do when trying to edit a theme.
- ALWAYS use a child theme. Many newbies already made this mistake twice or more in their coding or programming life and by the time their whole work has been screwed up, that’s the only time that they really learned not to mess with the core. Every edit that you have made in there will be lost and all the codes you have worked hard for will be gone the minute you make some updates on the theme. So, I suggest that the best thing to do is to never mess the core and just stick to the child theme.
- Don’t be stubborn and not follow the rules of WordPress because they are there for a good purpose and keep in mind that it’s for the benefit of your website as well. Make sure that you use “enqueueing scripts” because they will lessen the amount of conflicts that can be found in the system should you tend to work on some coding in there.
- Pick the right theme for the website. Don’t just choose it because it looks cool. Pick the one that will actually fit for the company’s needs. Like if you’re trying to build a website for a photographer, it’s best that you only choose a photography theme.
- Take advantage of the pre-worked theme on WordPress. This makes your job easier and it would save you a lot of time. You probably won’t even end up editing anything on your theme if you know how to maximize the purpose of those default and ready-made theme on WordPress. Make use of the short codes as well, because they are the easiest way to work around it. Simply go to the Theme Options part of your dashboard and you can already do the magic from there.
- Never customize following the wrong order. You must know that WordPress has rules and patterns to follow. Never go to the template files and make an edit, especially if the change that you need is very minimal. If you’re going to customize, make sure that you first check if you could work it with a theme option.
Then follow it up by editing the CSS for the design. Next would be going on the functions file to create changes on the structure (but just make sure you know what you’re doing there or it could also ruin all your work!). You can only add a new template file once you’re done with that step. Lastly, pick a plugin that you think you need for the major changes. Note that the plugins are only applicable for MAJOR CHANGES or final retouches involving additions.
- Don’t ignore the setting that the function file built for WordPress. Everything that’s in there relies on that file and also editing with CSS. Know everything that you need in this area and you will realize the many benefits that you will get from them.
- Check everything on every browser possible. Don’t just stop testing it on Chrome or Firefox because you’ll never some bugs or some errors could come up from other browsers that would eventually affect the performance on Chrome and Firefox. Yes, it happens.
Final Thoughts
Editing a WordPress theme is no doubt going to be a lot of work, but it’s worth it in the end. As long as you follow all the necessary rules and tips I have here, then you’re good to go. Don’t just rely on the things that you already know or you’ve been used to doing all these years. Remember that technology and Internet and whole computer system keeps on progressing and updating in almost a daily basis.
What you do and know before, might no longer be applicable today. This is why you should always do some research and you must always update your knowledge on pretty much everything related to WordPress. You will have an edge in this industry if you know a thing or two about PHP and HTML. These things are even going to be your best friends!
Finally, never be insecure if you think you only know a few things about WordPress and making changes on the default or child theme and picking your own. This is your gateway and your reason to learn more about this topic. Don’t allow yourself to be intimated of the whole thing and the technical process of designing your website. And of course, don’t forget to have fun! All these technical stuff will be a lot lighter to bear if you have fun!
Leave a Reply
You must be logged in to post a comment.