In this session we show a member how to create a clean landing page by adding some php functions using Thesis filters to disable the footer and header thus leaving us with a minimalist custom template.
Rick: Okay so now Sean, I’m unmuting your microphone there.
Rick: How are you doing?
Sean: I’m good. Can you hear me?
Rick: I can hear you just fine.
Sean: Oh good, okay. Good.
Rick: So now you want to do a minimalist custom template right? And you want to have a custom template that is completely blank except for your post content that you can format the way you want to use it as a landing page.
Sean: Right. And Rick, you used it as a… you did a post. Now is it not supposed to be a page that you do with this?
Rick: No, absolutely… it’s easier for you to do it as a page. Absolutely.
Rick: And let’s go back to… let’s see, it’s definitely easier to do it as a page. The thing was is that you know, I had done this little seminar on how to make user selectable custom templates for posts which is actually a fairly unusual thing. I mean, the custom templates for pages is very common. I’ve got all kinds of stuff on the site about that. But I was going to show you how to do this and in fact, if you look… oh no, I haven’t posted it there. So I’m just going to copy this… I need a raw code, copy it.
So what we’re going to do is on this site here, I think we will. We’ll just keep on doing it on Laurraine. I’m just going to add it to the bottom of this.
Rick: And what this function does is… the first part of it are these different filters. So you’ve got a filter where you want to turn off the footer, a filter where you want to turn off the sidebars and a filter where you want to turn off the header. And so, we have a little function that just returns false for each one of those things.
Rick: And then we create this function that says you know, byob landing page and the landing page function asks you know, if it’s a specific page. So in this case, if it’s page 40 then add the filter Thesis show filter and that means this return false so the footer doesn’t show and the filter shows sidebars, it returns false so the footer doesn’t show. And then add filter show header and it returns false so it doesn’t show. And actually, this is not necessary.
Sean: Rick, can I ask you a question?
Sean: Are you using a… is this inside of Thesis or is this in your… I don’t understand what this is that you’re putting this code into.
Rick: Well right now, this is the custom functions php file and I’m using Netbeans as my code editor.
Rick: If you’re not familiar with this then you should really watch these videos over here before you dive into it. You should watch the first Customize Thesis Like a Pro video. Under Intermediate Tutorials, you should watch the Customize Thesis Like a Pro 1 and this one, Managing the File Structure because that will show you how to use that stuff. And then you should probably watch 3 which is How to Install Netbeans, How to Use Netbeans and that kind of stuff, at least the first couple of lessons inside that lesson,the first couple of parts inside that lesson. And then after that, you should watch this Introduction to PHP and in particular, the one I’m referring to is right here, Customize Thesis Like a Pro Introduction to Editing PHP. And once you’ve watched those and worked through those then you’re in a position where you can muck about with the code.
Sean: I don’t want to mess it up. Right.
Rick: Yeah so it’s dangerous to deal with it before you’ve done those but the good news is you know, you can get through all 3 of those in probably 3 hours. That’s probably about 3 hours of video but you can probably work your way through those in 3 hours and then you’ll understand what to do with this code. Because that’s what… I mean, this is another plugin that I have hankering to make. I don’t know, maybe I’ll make this one instead of the feature box one first and you know, it would be a landing page plugin where you could select the page that you wanted to use as a landing page and then you know, would give you some special styling for the header and footer and stuff like that on those pages. I mean, not header and footer but some special heading style so you could have different styles of headings and stuff.
Sean: That will be nice.
Rick: Okay well, sure, why not? It was on the shortlist anyway. But I still want to walk through this so you can see how this works.
Brian asks, “What’s important about this?” Now that’s… yeah, if is page 40. Well Brian, this function right here is not inside of… or doesn’t know anything about our meta box that allows us to pick a post for you know, assign a custom post type to a post type or a custom template to a post. This is much more basic. This just asks you know, if it’s page 40 or you know, in advance that you want your page to be… or that page 40 is supposed to be a landing page. And if you know in advance that page id 40 is supposed to be landing page and you put that in. And if you have several then you would put several in you know, it’s very much like my… on my templates, right?
Here’s the little controlling function on my site that controls which custom template is used where. And so if it’s home then it uses the homepage customization template. Else if it’s page and then it’s this long array of numbers, these are my lesson pages and so it has this lesson page customization. And then if it’s these pages then we use the member page customization and then if it’s this page, we use a download page customization.
And so you know, this is just kind of a recurring if else statement applies a custom page template to a page based on its page id. And this is a much simpler alternative to using that meta box that we did in that previous lesson. But the thing is, the meta box doesn’t require you to come in here and program it every time, right? Every single time I create a new lesson page, I have to come here and add another number. So you know, a couple of days ago, I guess it was yesterday, we added… no, 2 days ago. We added the Monday lesson as an actual lesson. And so, in order for me to use all my lessons’ specific content, I had to come in, open up my custom functions… well actually, I have a special file for it but I had to open up my templates file and change or add another number to this list. And next week, I’ll have to add another and you know, I have to add another number every time I had a lesson. So I could use a different system for doing that than this but since I started it this way back when I was using… and my page numbers were at 57 you know, I’m just continuing to use the old system.
Okay so that was answering Brian’s question. So we have all these filters going… I guess we need to know for sure what our page id is so let’s go over to our page id and just get that again. Let’s see, let’s go to pages and let’s do it on this page called category columns. So if we edit that, it’s actually page 70. So what we’ll do is… so instead of 40, it’s 70 so we’ll just come over here and say page 70. If is page 70, save the document, and we’re just going to upload this again and view this page and oh what have I done now? Cannot re-declare byob show header…so I’ve got that in there twice. Yeah, this is the one I was supposed to comment out and this is the one I was supposed to leave in. Okay save and there it is.
Now for whatever reason, these pages take comments. I normally don’t have comments on my pages so I normally just come right down here to comments and say disable comments on all pages. Don’t know why I didn’t there and refresh that and now all it is just the heading and the text.
So I will do one of these… that’ll be the next plugin I work on here over the… I might work on it some tomorrow but it might happen over the weekend. But I’ll put together a plugin and I will… I’m going to put this code on the forum so that you can see what the code is and then you can get the code if you want. And then I’ll post a link or put a little announcement in that section in the forum when I have this plugin up but the plugin will be located here under plugins. So, it’ll be here.
Sean: So Rick?
Sean: Well that plugin will make it… your page look like just you had the last screen?
Rick: The plugin will make the page look just like this except that I think I’m going to add the ability for you to make your h tags different like you can center them instead of having them on left side and they can be bigger and maybe different colors and different font styles. I think I’m going to do something like that.
Sean: It’s that header right there?
Rick: This is an h tag so this is a h1.
Sean: But I can change it to whatever I want.
Rick: Well, it’s this…where is post again? Am I in the right one? Yeah, I am. So pages, all pages and then it’s category columns. That’s what it is right there. It’s the post name.
Sean: Oh okay.
Rick: So sure, you could easily come down here and you know, add a new heading and if we turn on the kitchen sink you know, you could say, I want to make that an h2 and I want to make it red. And then update and you know, you could even say I also want it centered, update. You could do that…obviously, I didn’t update the centering. I mean, it’s certainly impossible to make all of your landing page modification there but I think what I would do is give you some options for re-styling the heading.
On my homepage you know, this is… well actually, as it turns out, this is my page title here but you know, I used the page title as a big heading and the purpose for doing that is so that the page title Thesis uses is an h1 tag and it’s very prominent. So you know, I want it to stay prominent so I want to continue to use the page title even if it is a landing page.
Sean: So where it said, “Attention entrepreneurs” that was a header or that was a page title?
Rick: Actually this is just a piece of text.
Sean: Where did you put that on the title?
Rick: Well this is added… actually, this whole block of stuff right here is added as a custom function to this page. I mean this is all custom programming and you know, in this case, it’s probably under templates actually. If we scroll down to our homepage template, homepage or front page template, I mean. Let’s see, yeah where did it go? Back up to the top, if is home… let’s see. Front, okay here it is, the home landing page. So all of that is created by this bunch of code that is added before the content box with this hook so you know, I created this class called full headline and then styled it using CSS and then wrapped that “Attention entrepreneurs! Learn how to create your own website” inside of this p tag or paragraph tag with the class of full headline. So there’s actually no h tag in this block of text here. It’s all paragraph text and the real h tag doesn’t show up until it’s gets down to this.
Sean: And that’s the title where it says “See a 74-year old grandmother…”
Rick: This is the page title.
Sean: How far is it at the page? Is it the first 2 lines?
Rick: I beg your pardon?
Sean: Where it says “74-year old…” That’s the page title?
Rick: Yeah from see up here, it is the page title.
Sean: And then in the page content, you just put the picture and the video and everything?
Rick: Yeah so this is… yes. You know, in my case, I wanted a sidebar in my landing page although I wanted all this stuff to be above the sidebars which is why I did it like this. You know, but I put the sidebar in, left the sidebar in this page and then just put my testimonials in beside it and then all the rest, right? Just insert a video and text and…
Sean: So basically with your plugin, I can just add the content in the page… what I want to put in the page content area.
Rick: Right, that’s right. You would just put it all in here. And you wouldn’t have to get rid of the sidebar, right? If you want the sidebar in there for things like the you know, like testimonials to go beside it then you can leave it in.
Sean: Yes and I’ll have to say and I want everyone to know, Rick so far, is the best resource that I have experienced in understanding Thesis. If you’re watching this video, you got to give Rick an opportunity. You will be happy and pleased because as me, I am a beginner and I already feel like I’m already able to do Thesis like a pro and it lives up to its word, Thesis like a pro. And that’s my personal experience and testimonial that I have. So thank you Rick so much.
Rick: Well, thank you Lewis. I appreciate that.