Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
As noted throughout the course, WordPress is at its heart a PHP application. More importantly, it is a highly evolved PHP application with hundreds of its own functions and methods built-in. Dreamweaver includes a feature that can open the door to this WordPress specific code to make it very straightforward to apply. Let me show you how to put it to work. So I have opened the index.php file from my basic WordPress set of files, and I've discovered all of the dynamically-related files shown here in Split view.
Let's say that I want to add a bit of PHP code to my sidebar.php file. First, I'll use the Custom Filter to isolate that file. So I'll go over, click on the Filter icon, choose Custom Filter and then in the field in the Custom Filter dialog box enter sidebar.php, click OK, and there's my sidebar.php file. Let me go ahead and switch over to Code view.
So I'm just going to place my cursor above the div that you see here, and I'll start to enter in some code. I'll start with a PHP code block, and once I do that I trigger standard code hints for PHP, and if they don't show up right away I can invoke them by pressing Ctrl+Spacebar, and there is a slew of functions, including various PHP functions. Many, but not all, WordPress functions start with the initials WP, so watch what happens when I enter those initial letters with code hints being displayed. W--so there's W-- and, as you can see, there is a lot of information about various PHP information that we see here, and if I hit the p character, well there are no code hints, because WordPress functions are not part of code hints generally, the code hints toolbar disappears.
Now you can however bring them in by turning on what's called site-specific code hinting, which is found under the Site menu. So I'll go up to Site and choose a Site-Specific Code Hints. Now there's an awful lot of power built into this little dialog box, but one of its best features, as far as WordPress is concerned, is how you don't have to do anything but turn it on. So let me just go ahead and click OK, and then we'll come back into that dialog box.
Although it's not immediately obvious a new file has been added to the site. Let me close up the CSS Styles panel so we can expand the Files panel, so let me collapse the blog folder and here right below that folder you'll see a cloaked file, called dw_php_codehinting.config. Now this file is to be used within Dreamweaver only, and because it's cloaked it will never be sent up to your server by accident. So now that I have this file added, let's go back to my code, and this time I'll invoke the code hinting one more time by pressing Ctrl+Spacebar and type in WP, and this time we have access to hundreds of WordPress functions.
So I'm going to complete this by entering a little bit more code. Let's say that I wanted to show a list of pages in the site, so I'll enter wp_list, I'll put in the P for pages there, and you can see the code hinting narrow down. And once I get to this point I can go ahead and hit Return and let code hinting do its magic and then I'll just finish off the function with a closing parenthesis, a Semicolon, and let's close off the PHP code block.
So now if I go to Design view, and I'll click Refresh, and then scroll down, you'll see a list of the pages that we have here. This is the output for the code that we just put in the sidebar, wp_list_pages, it is of course unstyled and not something we want to keep so I'm going to go ahead and delete that, and we save sidebar.php. And that's just a small example of what's possible. Well, Dreamweaver is a Site-Specific Code Hints features won't teach you everything you need to know about WordPress' function, it can provide a significant leg up and one that we'll take advantage of later in this course.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.