Build Your Own Business Website header image

Community Library Website – Part 45, Add Thesis HTML Structure to Teasers

Difficulty Level -

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.

This is the 45th in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS). In this lesson we modify our custom catalog page so that the teaser display inherits the Thesis HTML Structure.

Community Library Website – Case Study Part 1 – Site Organization
Community Library Website – Case Study Part 2 – Create Custom Post Types
Community Library Website – Case Study Part 3 – Custom Post Type Configuration
Community Library Website – Case Study Part 4 – Custom Taxonomy Decisions – Theory
Community Library Website – Case Study Part 5 – Custom Taxonomy Decisions – Practical Application
Community Library Website – Case Study Part 6 – Incorporating Existing Data Into the Project
Community Library Website – Case Study Part 7 – Creating Hierarchical Custom Taxonomies
Community Library Website – Case Study Part 8 – Creating Non-Hierarchical Custom Taxonomies
Community Library Website – Case Study Part 9 – Creating Custom Post Meta
Community Library Website Case Study – Part 10a – Restore the Database Using BackupBuddy
Community Library Website Case Study- Part 10 – Creating Custom Post Meta – Continued
Community Library Website – Part 11 – Importing Existing Data to the Website
Community Library Website – Part 12 – Prepare Existing Data for import by the CSV Importer plugin
Community Library Website – Part 13 – Import Existing Data Using the CSV Importer Plugin
Community Library Website – Case Study Part 14 – Date in Permalink Configuration
Community Library Website – Part 15 – Importing Images
Community Library Website – Part 16b – Final Data Import
Community Library Website – Part 17 – Add Thesis Post Meta to Custom Post Type
Community Library Website – Part 18 – Add WordPress 3.0 Menus
Community Library Website – Part 19 – Add Post Meta and Taxonomy Information to the Post Display
Community Library – Part 20 – Add topics and audience to book display
Community Library – Part 21 – Display the Rest of the Post Meta in the Post
Community Library Website – Part 22, Create the Permalink Structure
Community Library – Part 23 – Remove Custom Post Meta from Post Display
Community Library Website – Part 24, Add Taxonomy and Post Meta Data to the Teaser
Community Library Website – Part 25, Add Taxonomy Data to the Teaser
Community Library Website – Part 26, Adjust the Teaser Styling Using Design Options
Community Library Website – Part 27, Styling the Teaser Using CSS
Community Library Website – Part 28 – Fine Tune the Teaser Display
Community Library Website – Part 29, Designing a Custom Catalog Page
Community Library Website – Part 30, Using a Query String in a URL
Community Library Website – Part 31, Adding Custom WordPress Menus
Community Library Website – Part 32, Add Custom Menus to the Catalog Page
Community Library Website – Part 33, Add Another Custom Menu to the Catalog Page
Community Library Website – Part 34, Troubleshooting Custom Menus
Community Library Website – Part 35, Add Styling to WordPress Menus
Community Library Website – Part 36, Add HTML Markup to WordPress Menus
Community Library Website – Part 37, Add WordPress Menus to Archive Pages
Community Library Website – Part 38, Add and Style a List of Tags
Community Library Website – Part 39, Add a Search Box to the Sidebar
Community Library Website – Part 40, Add Links to the Sidebar
Community Library Website – Part 41, Add Taxonomy Drill Down Browsing
Community Library Website – Part 42, Custom Loop to Display Custom Post Types
Community Library Website – Part 43, Simple Custom Query
Community Library Website – Part 44, Custom Taxonomy Query
Community Library Website – Part 45, Add Thesis HTML Structure to Teasers
Community Library Website – Part 46, Display Posts from the Last 60 Days
Community Library Website – Part 47, Custom Loop If Have Posts
Community Library Case Study – Part 48, Increase the Number of Posts that Display on the Custom Catalog
Community Library Website – Part 49 – Naming Conflicts in Custom Taxonomies
Community Library Website – Part 50 – Find and Replace Semi-colons in the Database
Community Library Website – Part 51 – Modify Taxonomy Names Directly in the Database
Community Library Website – Part 52 – Sort Posts by Meta Value
Community Library Website – Part 53 – Show the Term Label Only when a Term Exists
Community Library Website – Part 54 – Sort Archive Posts by Meta Value
Community Library Website – Part 55 – Add Sort Order to Custom Taxonomy

Video Transcript

Oh that takes us to step 4 then which now we want to add some HTML structure to this so that it looks decent. And what we’re going to do is we’re going to use the Thesis structure for doing this. Because what Thesis does is it takes posts and or teasers and it groups them into pairs. And Pam, you’re asking… it’s doing that blank spot thing? Yes it is and this step 4 is going to solve that. That is that blank spot that you see is going to go away because of what we’re going to do here.

And so what we’re going to do here… well, actually Pam is asking now and it needs to display all of them not just 10. Yes and actually, that will be another parameter that we’ll have to add to the query because right now, the way it works is if you don’t tell it how many posts to show, it will only show 10 because that’s the way this WordPress site is set up. But we’ll get to that here in a moment.

Okay so the next thing then though is to replace that Thesis teaser with the Thesis HTML structure and I forgot to elucidate what this means that Thesis groups teasers by pairs and it does that by counting the teasers. So essentially goes 1, 2, 1, 2, 1, 2, 1, 2… it’s not exactly like that but every time it hits 1, it does something at the top of the teaser and every time it hits 2, it does something at the bottom of the teaser. And so, we’re just going to steal the Thesis code for that and place it in our code.

And so, we come down here and instead of Thesis teaser, we get rid of let’s see… yeah, we’re going to get rid of that and while. Okay so what happens here is… I missed an if statement. If… so what happens is it says if the teaser count divided by 2 has a remainder of 1, then do this at the top. Otherwise… and make it… make right equals false. Otherwise, do this at the top and make right equal true. And then it says… and then if this at the top is such and such then put the hook in then do the Thesis teaser then close it out and then increment the teasers. Well, right now, this has not been defined, right? Teaser count hasn’t yet been defined so teaser count’s going to be equal to zero until it goes through this once which isn’t what we want to do. So we have to initialize teaser count and so we’re going to say before we hit this loop… but inside of our for each loop… because this is going to happen repeatedly, we’re going to say teaser count equals 1.

Okay so now, we’ve defined a variable called teaser count. We’ve set it to 1, it’s going to go through this process of saying, okay, essentially, is this the 1st teaser? If it’s the 1st teaser, give it the top class. Otherwise, if it’s the 2nd teaser, give it the bottom stuff. And then if it’s… and then again, essentially, says then if it’s the top, put this in the top then if it’s the bottom, put this in the bottom. And then once you’ve done that, increment the teaser count. And then we have this fail safe for when there’s an even number of teasers. That is, after the loop, if the teaser count is an even number essentially, then treat it as if we’re at the bottom anyway. And I’m missing something here… what am I missing for each? Okay and then that next one is if is page and why is that showing me… because I’m missing something here. If… okay, it almost feels like I must be missing a bracket. I was. I was missing a bracket. I was missing… so that’s the big outer bracket and then for each, that is the next bracket. Oh actually… oh yeah, function if for each and that’s what it was. And this was the if… yeah, I was missing a bracket. Okay, I see that now.

Okay so now, when we save this, what we’re doing is we are creating the standard Thesis default behavior for each of those instances of the name. Okay so we’ve uploaded it, now we’ll refresh it. Okay and now we have audiobooks and our audiobooks are nicely organized. And then we have Bible and Reference and those are nicely organized. And that was an uneven number of those so it stopped and it left a nice blank space and then came up Biographies. And again, it was an uneven number and so on and so forth. So now, it’s behaving the way we want it to behave except we do not have any date filtering yet.

0 Comments… add one

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

Leave a Comment