Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
There is just one major area left to tackle, and that's the footer. Like the other sections, you'll need to modify the CSS, HTML, and PHP. As with the other areas of the page there is a separate PHP file that controls the footer content. And since we will need to modify the code of the page, let's copy that file footer.php, from the parent theme folder to the child. So I am going to expand my Files panel and go up a little bit until I find the custom, the folder that has our parents theme, there is my footer.php file.
So I am going to copy that, close custom, select roux, and paste it in with a Command+V. Let's collapse the Files panel, and now we are ready to open up our index.php file. Let me temporarily collapse my CSS Style Sheet, so I can get to that a little easier. And I will open that up, and now we can reopen styles.css. Here is the blog page index.php. I'll discover those files, use my Custom Filter so we can hone in on our specific files we are interested in, which are style.css.
Put a semicolon to separate and footer.php. So let's go into Live view, and we can compare what it is that we have to work with. Let's scroll down to where the footer is and it's just a plain copyright line, not a whole lot of code there at all. Whereas on the blog_comp, I am going to scroll down, we have a tremendous amount of code, looks like 25 or so different links. As we can say, as I go over each of those, these are all links here. That's fine, the easiest way to handle a situation like this is to copy all the content and bring it directly into footer.php.
So I am going to go into Code, choose my Source Code. And then let's go down to the footer area, which looks like it starts about here. And I am going to choose everything that's within the footer tag, copy it, and head over to index.php. This time I will of select footer.php, and you can see I have a similar sort of footer tag here. So I am just going to highlight the content in that, it's just one line and delete it and then use Command+V to paste in my copied content.
Okay let's save the page, and let's make sure that all that content came in. So I'll refresh Live view. And let's scroll down to the footer. And I can't quite see all of it, well it looks like the links are there, however, we need some serious styling, and we will get to that in just a moment. More concern to me at this point is if I look at the code, so as I mentioned, I have got a whole series of links here, looks like about 25 in all.
And if we leave them as they are, they are not going to work correctly. So if you remember, we introduced a special PHP routine, way back in the handling the header lesson, and that's going to be a perfect fit here. To handle this many links, let's break out our Dreamweaver Power tool, Find and Replace. So I will go to Find and Replace, choose Find in Current Document. Since there is no other links in this document, this is a safe thing to do. And I'm going to look for a href = and then my opening double quote, and let's copy that so I have that starting point, paste that in the Replace field.
And now I want to add in my PHP code, which starts with a PHP opening bracket and then echo siteRoot open and close braces, open and close quotes. And in the middle the argument we are passing, which is the name of the folder, blog. And then let's close that off with a semicolon and close the PHP code block with a question mark, angle bracket. All right, so we have the PHP opening code block, echo, siteRoot, blog.
Let's use Replace All and looks like 27 different items were replaced and here you can see, for example, on line 10, the PHP code comes in ahead of board.htm. So let's save those changes and then I am going to right-click on this tab group titlebar here and choose Close Tab Group, so we can recover some of our screen real estate. And let's take a look at what we have in Design view, I will click Refresh. Let's go down, and now the links are still there as I said, however, they do need a tremendous amount of styling.
Luckily, there's a full footer section in the blog_comp that we can bring over, pretty much intact. So let's head over there, I will go to main.css, and we will find the footer styles, which are starting around line 629, and I am going to copy all of these. Go to index.php my stylesheet, scroll down to the very bottom, make a little extra line there and paste them in.
Okay let's refresh the page and see what happens. Well, things are definitely better, we can see our links, and it looks like we have a little bit more adjustments to make, but at least we are moving down the right path. Now let's see, what's missing here obviously is the yellow background color. So let's head over to the blog_comp, I will go into Split view and go into Inspect mode, scroll down to the footer area, and let's see if we can uncover that. So I do some hovering over some contact, and I'm going to go up the DOM using my left arrow key.
And here we see that in the page footer rule that you see on the CSS Styles panel, there is a background color, so let's go to that rule. And I can say that it's actually one of the styles I copied, but what's problematic is that I don't have this id in my footer rule. So sometimes it's easier to change the HTML than it is the CSS. So let's go back to index.php, the footer tag, and I am going to go all the way to the top and just add in that id.
Okay we will save this page and then refresh the screen, and that's worked out pretty well. We now have our three columns and the yellow background, so I have a few remaining things to take care of, and this is the last technique that I want to pass on to you, as you are doing these types of conversions, sometimes it's more efficient to just go ahead and add the rules in yourself, rather than trying to figure out what it was that they did in the comp.
So let's go to style.css I am going to go into Split view and the first thing I want to tackle is the border that you see across the top here, that's not something that we want in this particular design. So I am going to go to pageFooter rule, and let's put in a new rule for a border-top and set that to none. Next let's take care of the centering that's occurring here, and we want it to be left aligned.
So that's an easy fix, add in a text align property, and set it to left. So let me click into here to see how things are working, and we are looking pretty good. Now one last check against the blog_comp, one thing that I notice as I go back and forth between the two is that it seems I'm using the right fonts and everything, but things are a little smaller than they should be. So, most likely what's happening is that things have somehow gotten reduced, they are proportional, but they're not the right size.
So what I would do in that case is set the font size for the footer to 100%. And let's click over, and well, that seems I have done it. Let's compare Design view to Design view. And while they look pretty good it does look like my headers are a bit off here, it doesn't actually seem like it's picking up the special web font that I'm using for headers. So let's Inspect that particular font there.
And here is the h3, and I can see that it's the font-family of Bitter, and that's what I am expecting. So I can see this is a footer3 issue. So let me go back into index.php, and I will open up style.css, here is my footer h3 rule. Let's set the font-weight to normal, since it seems like it's making it a little bit bolder than it should be. Well, that seems to have done the trick.
So here is our index.php file, and there is our blog_comp. All right, I think we are in great shape, congrats on completing a major conversion project. With the techniques we have used throughout the lessons in this chapter, you can re-create pretty much any static design as a WordPress blog page.
Get unlimited access to all courses for just $25/month.Become a member