How To Edit The WordPress Header | WP Learning Lab

How To Edit The WordPress Header | WP Learning Lab

September 2, 2019 100 By Bernardo Ryan


[MUSIC PLAYING] Hey it’s Bjorn from
WP Learning Lab. In this tutorial,
I’m going to show you where to find the
WordPress header.php file where you can make the
edits you need to make. I’m not going to
show you any edits to do in there because I have
no idea what you’re doing, and really, because
you’re in the php file, the ability to do stuff
is pretty much limitless. So there’s really not
much I can show you because I have no idea what
you want to accomplish. If you tell me what you need,
you can comment in the comments below, and I’ll see
if I can help you out. But barring that, here’s
how you find the header.php file so you can make some edits. First, we log into
the dashboard. Then we go to appearance,
and we click on editor. And I’m going to press
Command F, or Control F, and type in header.php. And we have the header
file show up here. Click on that to load
that file into the editor. And this is now all the php in
the header file for the Avada theme. And I can go in here. I can edit whatever I want. This looks very
intimidating if you’re not familiar with WordPress
hooks, theme hooks, and php. So if you’re not
familiar with those, I don’t recommend you
mess around in here because one wrong move and
the whole site goes down. So it really isn’t
the place to mess around if you don’t
know what you’re doing. One drawback of using
the editor like this is if you make a
change and you save it, you can’t undo what you did. So you either have to
remember what you did and then change it back
if you break something, or you have to go and download
an original theme Avada theme copy of the header
file and look in there to see what the original
should look like. A way to get around this
is using an FTP client. So I have the site pulled
up in FTP right here. If we go to the content folder,
themes folder, Avada theme, and then find the header
file, and right click on it, and choose open width. And then I’m using Sublime
Text 2 as my default editor. And here, I can make a change. For example, if we
go to the live site, we see it loads just fine. Now if I go, and I’m just
going to delete all of this. Save this file. And this is going
to crash the site. Refresh this page. And holy moly, that’s not what
the site should look like. And this can happen
at any second when you’re editing in the
header file or any php file in the wordpress
theme for that matter. So now is when the
adrenaline kicks in. You’re a little bit panicked. If you’re in the editor, in
the theme editor over here, you have to know exactly
what you took out. Otherwise, you can’t get
it back very quickly. You can always download
the original file like I said and
find the original but that might take too long. So instead, if you’re
using FTP in a text editor, I can just go into edit
menu, click on Undo, left, delete, it puts all the
stuff back, save the file. Files uploaded again. Refresh this page,
cross my fingers, and everything’s back
to how it should be. So that’s the benefit
of using an FTP client. Even if you edit this file
in the cpanel File Manager, there is no undo command in
most of those file managers. So if you make that
change, you better know what you changed in
case something breaks. I recommend you use an
FTP client to do it. And I also recommend
that you don’t mess around too much
in here unless you know what you’re
doing or you know the exact thing you want to do. For example, you might
just be copying and pasting a Google Search Console
verification code meta tag in here. In which case, you just go in
here and paste the meta tag. Let’s pretend this is. I just copied one from below. Save the file, and
then it’s all good. You’re not going
to break anything by just adding meta tag as
long as you don’t interfere with any php commands. So simple changes
like that, anybody can do more advanced changes. Do it only if you
know what you’re doing and make sure you have a way to
revert back to the working copy if the site breaks. And that’s where we edit
the header.php file. I hope this video helps you. My name is Bjorn
Allpas WP Learning Lab. Please make sure you like this
video, share on social media, subscribe to our
YouTube channel, and check out
wplearninglabe.com where I publish more tech tutorials
like this every single day. Talk to you soon.