This is the fifth in a short series on creating custom template styles for posts. We will be using Thesis hooks and filters to create these “post templates”. In this part we write the function that removes the header, navigation menu and the footer from the template. We use the thesis_show_footer filter to remove the footer.
But the next thing we want to do is go on to step 5 which is… oh actually, it’s not at its appropriate sidebars. Step 5 is to make the minimalist one and again, this time, we’re going to use Thesis filter, Thesis show filter to remove the footer…I mean, Thesis show footer to remove the footer. And then we’re just going to follow exactly the same procedure as we’ve followed in the past.
So we’ll come down here to this function which I’d misnamed and so this is byob minimalist post style. And so again, we’ll grab the global post. We’ll ask if it’s single, we’ll get the post template style by using that get post meta.
So we’d get the post meta here, get post meta post style selection and if byob post template style equals minimalist… so we’ll come back and grab that minimalist. If it equals minimalist then we are going to remove the default header so remove action thesis hook header thesis default header remove action thesis hook before header thesis nav menu… because we’re going to get rid of the nav menu too. And then we’re going to add this filter, Thesis show footer and then it’s going to be this little function here, byob no footer. And so, that’s the other little function we created, function byob no footer. It just returns false to something and in this case, we are returning that to the filter, Thesis show footer.
So all we need to do is add this function to our… add this function to the site and we’re going to add this function before… we want to add this function up in WP head, is where we’re going to do it. So it’s add_action and it’swp_head… that’s the hook we’re going to use instead of one of the Thesis hooks because this wp_head fires before all of the rest of the Thesis hooks. And then we’re going to call this function… what the heck was that? Copy it, paste it. That should do the job, actually. Save the document, upload the document and then we’ll test the document. And we’re going to test it on the Van Cherries and you can see now there’s no header and there’s no footer and there is… actually, I suppose we could also get rid of comments and previous posts and next posts and all the rest of that stuff. And if that’s important, we can go ahead and follow through on doing that but you get the idea. What we’ve done is we have created this template that only shows… that does not show the header, the footer or the sidebars. It only shows the post and we could certainly get rid of the post content and the… I mean, I’m sorry. Not the post content but the comment stuff and also the next post, previous post things as well, if we wanted to.