Build Your Own Business Website header image

How to upgrade from Thesis 1.x to Thesis 2 Using the Thesis Classic Skin – Part 14 – Adjust the Front Page Template

Difficulty Level -

Filed Under Topics -

Listed Under Lesson Subjects -

Applies to -

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.

Now that we’ve our page template is done for our upgraded Thesis 2 site, we’re going to go back to our front page template because our front page template actually has a different set up. Let’s look at our example here, our front page template actually has this feature box in it with the dynamic content gallery in it.

Place Dynamic Content Gallery in the Featured Area

So what we’re going to do now is create the ability to put the dynamic content gallery in the featured area above the content here in our Thesis 2 site and that’s the only change we have to make to the front page.

In our Content Column but above the Loop, we’re going to create a container, we’ll call it Feature Box, add that box. We’re going to give it an id of feature_box and we’re going to give it a hook name and it’s just going to be feature_box.

The reason we’re going to give it a hook name is because we’ve got this custom function that we’re using to insert the dynamic content gallery and there are other ways we could choose to do this but I want to continue using this as an example of showing you how to migrate a custom function.

We’ve got our Feature Box, we’ve created a hook for the Feature Box and we’re going to drag that up into the Content Column. We’re not going to do anything else with it, we’re going to leave that alone, save the template.

Now we’re going to come over here to FileZilla and make sure that we connect up with our site, thesisestore so we’re going to connect then go down to wp-content, thesis, skins, classic and we’re just going to make sure that we’ve got our custom.php file so I’m just going to download that real quick.

Where to Add Custom Functions

If the end user is going to add custom functions like they used to in custom_functions.php, the place to do that now is in the skin files custom.php file. There’s one other place you could put it and that is inside of Thesis, there is a master.php and you could put it inside of master.php instead. In that case, it would apply to every skin that you have.

What we’re doing here is we are applying it only to the Thesis Classic Skin and that’s why we’re using custom.php rather than master.php. One of the benefits of doing it that way of course is that, if you zip up this skin to take some place, it will zip the custom.php up with it so you have that to go along.

So we’ve got our custom.php file and I’m going to open that, thesis2skins then inside of thesis, skins and that is the classic skin, open up custom.php and it’s blank.

Adding the Custom Dynamic Content Gallery

Now, we’re going to look for that place where we have that custom dynamic content gallery. It must be up at the top and I just ran past it. There is a search, there’s breadcrumbs, there’s the content gallery. I’m going to go ahead and copy this but I’m going to change that name. Add the dynamic content gallery to the front page then front_page_dynamic_content_gallery.

Adding Conditional Statements

Now, I want to put this in and if statement, if function exists, dynamic_content_gallery then we’ll actually fire the dynamic_content_gallery. So I’ve slightly improved our function here but this is how the dynamic_content_gallery is being added then we’re going to add this to a hook so it’s add_action, just like Thesis 1.

Now, the hook name is the thing that’s going to be interesting and different then the front page and the content gallery. Let’s go figure out what that hook name is so come over to our Feature Box, we look at the unique hook name and this says, it creates a thesis_hook_before_container_{name} which was feature_box, thesis_hook_container_{name}_top which is what we’re going to use.

We’re going to use the thesis_hook_container_feature_box_top, that’s the name of that hook. We go ahead and save this then we’ll come back over to that custom.php and upload it back to our site.

Import Existing Code to the New Thesis 2 Site

Make sure we’ve saved our template, we refresh this template, we should have the dynamic content gallery in place. No, not yet. So it’s Feature Box then it’s empty, div id=”feature_box” and there’s nothing inside of that so I think I must have the hook name wrong.

Let’s look at that again, front_page_dynamic_content_gallery, get that name right. That;s it, I spelled that wrong. If the function exists, that is if this function exists then do it. PHP is very sensitive with typos like that. Let’s refresh it, there we go.

We have just imported that existing code to the new site and if we just want to review what it looked like before. This is what it looked like before and its add_action statement was up here, add_action(‘thesis_hook_feature_box’, ‘home_page_smooth_gallery’); that was the add_action statement that was working in the past.

0 Comments… add one
0 comments… add one

Leave a Comment