It can be difficult to know what file your WordPress theme author coded something in. You can spend hours sorting through php files and never discover where a certain line of code was stashed. In this video – Jason helps you use a cool plugin that will easily reveal where code is located and what file to edit.
Full Video Transcript
Hey guys what’s going on? My name is Jason. I’m the Lead Developer here at WebTegrity (San Antonio, TX) and I have a pretty cool trick for you today- if you’re trying to make a change on a template (particularly one that you didn’t build and is a little complex) and you don’t know where to start.
Now, a lot of people have themes that are built by developers that offer user interfaces for a lot of the complex changes on the website but you can’t change everything. This is assuming that you’ve already looked through all that. Right? You’re really trying to find this.
What you might need to do is start digging into those PHP files. If you’re not a “hard-core” Developer, that’s a little bit of an intimidating task. There are a lot of PHP files. It’s not immediately known what each of them does. You certainly don’t know where to start to find the information that you’re looking for. Some of you may have gone into the editor. If you go to ‘appearance’ and ‘editor.’
Let me show you what I’m looking at:
Here we have dipanddo.com our kind of “playground” website here at WebTegrity. You’ve probably gone through some of these (looking, kind of “guesstimating”) where it might be. Maybe you’re doing a ‘command F” function to try and find the piece of content that you’re looking for but this could take forever and it’s really not that efficient. Or, you may have started to study the WordPress template hierarchy (which is a little bit of a puzzle all on it’s own.) Right? This is even complex for me to teach people when I’m teaching them how to code from scratch. It can get even more complex than the template hierarchy that you see in front of you when you’re talking about themes that are made by grandiosity developers- things like ‘Avada’.
Really hard to dig into those PHP files and find what you’re looking for if you don’t know where to start.
Luckily I have a really cool trick for you. It’s a plug-in called “What the File.” I think it’s appropriately named because at this point in your search to find what you’re looking for, you’ve probably have cursed a few times. “What the File” is a very lightweight plug-in.(Let’s go ahead and ‘Add New’.) Let me show you what this thing does (which is pretty cool.) Like I said- lightweight, installs real quick, isn’t going to slow your website down and when you’re done finding what you need to find you can go ahead and delete it. So we went ahead and ‘installed’ and ‘activated’ it. When we look at the front side of the website, all of a sudden we get this logo in our admin bar. If you hover over it, it will tell you exactly what PHP file is being used to display that information. At the top it will tell you the major PHP file being used (index.php) but it will also let you know any template parts that the PHP file is calling (maybe in other parts of the theme.)
So it really helps you narrow down what you might be looking for and really solve the problem of finding a piece of text that you’re trying to change or maybe you don’t like this RSS feed and they haven’t given you the option to get rid of it and you’re just trying to find where it’s located. This is a great place to start and can really speed up your troubleshooting process.
If you have any questions please put them down in the description. I’ll be happy to address them. That’s all I have for this video. I’ll see you guys next time!