Build Your Own Business Website header image

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Part 8 – Question and Answer

Difficulty Level -

That’s what I had to present today. Next time we’re going to create a custom landing page and then we’re going to add custom content elements in that landing page by using custom post meta and that kind of stuff. So I’m going to take questions if anybody has any questions for me here.

Using the Same Custom Body Class in Different Templates

Trish has a question about adding custom body classes, “So let’s say I want to use the same custom body class in different templates, is there a way to create a conditional that will call at the function for X number of pages and so where would you add that conditional statement?” Well, yes I mean there’s all kinds of ways to add a custom body class so for example, you could in the byob-custom-functions.php file, you could a conditional “if is page” such and such and add that custom body class that way.

If you are designing somebody’s site, well actually Trish I’m just going to unmute your microphone let’s talk about for a second. I just unmuted your microphone, do you have one? Are you with me?

Trish: Yes.

Rick: So, what is the use case?

Trish: So I have 2 templates in there, they have a common area where I need to have the same body class for both templates. So in this case I don’t want to repeat the same function in each of those templates but instead it’s just a shortcut and I was thinking so maybe within functions.php that will be the case where we create the functions or…

Rick: Well, you can do that although it’s not going to be simpler because it’s going to have to run on every single page load and it’s going to have to ask “if is page template” such and such or page template such and such, add this body class whereas if it were in the template specifically then that question is only asked when that template is loaded. So that’s one piece of logic that doesn’t fire every time a page fires.

Trish: All right.

Rick: And then also, you know the conditional logic is probably I mean there’s probably more to the conditional logic than there is to simply having two different functions. Now, however if you’re talking about an existing template, we’re talking about our own custom templates here. You’re not going to do this in an existing template because it’s going to get overwritten when you have an update to the theme. So if it’s to an existing template then you would create a function in your custom-functions.php file and then you would say if is template page or if is template archive.

You know, there’s a whole bunch of different types of conditionals you can ask and so you could do it on a page by page basis saying you know, if is page 12, 17, 35 or 246 then add this custom body class. You can do that too but that tends to be difficult to maintain and difficult to remember.

Trish: Yes.

Rick: So what I just demonstrated really only works for custom templates you’re creating yourself but if you want to attach to another custom template, it’s the same kind of function it just happens to be a different conditional. So if this was in functions.php you would say, if is template such and such then classes equals this and then you’d return the classes.

Trish: All right.

Rick: But you always have to return classes so you’d wrap this piece of the function in the if statement.

Trish: Okay.

Rick: Does that answer the question?

Trish: Oh yes, perfect.

Rick: Okay. Anything else? Andrea asked, “Will this video be up by next Tuesday?” Yes, you know it feels to me like our videos are starting to come back up faster but there’s a hurricane in the Philippines again so we’ll have to see. They have been coming out a little quicker so chances are, yes it will be. But anybody can email me and ask me for theses templates and I will give you copies of all of these templates plus the byob-custom-functions.php file.

Something that I have not done yet but I plan on doing immediately is putting all this code in with the videos too but the video probably will be available by Tuesday and Andrea, send me an email and I will send you all of the files from tonight and that’s true for anybody else. Anybody else who wants the files, all you have to do is send that to me. Any other questions?

Well, like I said next week we’re going to keep on doing this custom templates but we’re going to do it with another level of complexity and we’re going to add custom post meta and then insert that custom post meta in the templates. Once you start doing that you’re going to find a huge change in what you can do with complex sites because custom post meta is really the key to having a complex CMS.

Customizing the Skeleton Theme for WordPress

Steven asked me do I have any experience with the Skeleton theme for WordPress. I have no experience with it whatsoever but if it looks like a good tool to you then maybe it’s great but I mean, you probably only need a couple of theme frameworks in your toolkit. I don’t know how hard it is to customize, I suppose if it’s a typical WordPress theme, the question about how hard is it to customize comes down to what kind of hooks it has.

So Skeleton theme for WordPress, “A responsive WordPress theme”. Skeleton, yes I remember this theme, Skeleton Documentation so it’s got some shortcodes. Okay, Layout Customization Hooks, skeleton_above_header, header, header_extras, below_header, navbar, before_content, after_content, before_sidebar, after_sidebar, before_footer, after_footer. Well, that’s not a ton of hooks but it might be enough, let’s see what filters it has.

It doesn’t have any filter so it’s not going to be as easy to customize as Genesis because if it doesn’t have filters then there’s all kinds of stuff in there that you got to say to yourself, “Gosh, how could I change that?” and the answer is going to be, “You can’t”. So I guess my answer is on some relatively simplistic level it’s probably not bad for customizing. Okay, viewport, stylesheets, let’s see stylesheets.

Well, I don’t know really exactly how complicated it would be. Simple skeleton, javascripts so yeah, I don’t know. It’s probably not easy to customize this Genesis because it doesn’t have filters and it has many fewer hooks. What about templates, what’s the story on templates? Tutorials, how does this flexible columns thing work? Well, that only works inside of content though so yes, it doesn’t look to me like it’s nearly as sophisticated as Genesis is and unless you had a compelling reason to learn another system, I would probably stick with systems you’re learning already yourself.

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
THIS IS A LIMITED TIME OFFER!
Subscription Options
0 Comments… add one
0 comments… add one

Leave a Comment