Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Anthony Hind
Anthony Hind
5,715 Points

Canvas theme (WOO Themes)

OK so i have a possible client who has purchased the canvas theme themselves and they would like me to look into slightly customising it for them mainly using css which is no problem at all but one of the things discussed was the ability to have full width content sections only on the home page.

As far as I can see the cavas theme does not support this other than with the use of the hook manager and inserting custom code.

Has anybody got any suggestions on how this could be done?

Any help would be appreciated guys!!!

6 Answers

Matt Campbell
Matt Campbell
9,767 Points

Sounds like you've already found the solution. Either use a hook or jQuery to add a wrapper that you can then set to 100% which will allow you to target the subsequent divs that need to be 100% width. You can use the jQuery wrap method or an action hook.

Anthony Hind
Anthony Hind
5,715 Points

Cheers Matthew,

I'll look into it a bit further just wasn't sure if i was going down the right path :)

Not worked with the Canvas theme before or really go into hooks yet

Anthony Hind
Anthony Hind
5,715 Points

OK so using WooThemes hook manager puts the custom block of code on every page which is a pain, I thought it may be possible to use the body class function and only display the certain block of code onto the homepage.

Got some advice from WooThemes support see below

           function woo_my_custom_block() {
if ( !( is_home() || is_front_page()  ) { return; }
?>
<div id="block1">
     <div class="col-full">
          hi!
    </div>
</div>
<?php
}
add_action( 'woo_content_before', 'woo_my_custom_block');

Would this be something that i would need to use in my front-page.php or functions.php file. does the my_custom_block need to be created as a separate file also ?

Maybe Zac Gordon could help me on this one?

Hope that makes sense any help on this would be appreciated!

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

It goes in the functions.php file.

You'll see that my_custom_block is just the name of the function you're adding to the hook. You don't need to do anything else :)

My only suggestion is included a template file rather than hard coding too much html if there is a bunch.

Anthony Hind
Anthony Hind
5,715 Points

Hi Zac Gordon,

Thanks for that so if i was to create a template file called content-block-1.php for example would i just refernce that instead of the HTML code in the functions.php in between the function code above ?

Anthony Hind
Anthony Hind
5,715 Points

Thanks Zac that makes a lot more sense to me now :)