Twenty Twelve
Creating new page template (2 posts)

  1. cktalons
    Posted 2 years ago #

    Here's the problem: Testing Home page template

    Password is: homepage

    This is a child theme of TwentyTwelve

    I created a new template based on the Front Page template. But for some reason the widgets are not clearing to the bottom of the page. It seems the problem is in the media query and I think to make the Home Page template's site-content to go full width (and thus clear the widgets to the bottom) I have to register the template in the functions.php file. Yes? How would I register the template?

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    this is how it is done in functions.php of the parent theme (very close to the end of functions.php):

    function twentytwelve_body_class( $classes ) {
    	if ( is_page_template( 'page-templates/front-page.php' ) ) {
    		$classes[] = 'template-front-page';
    	return $classes;
    add_filter( 'body_class', 'twentytwelve_body_class' );

    in your child theme's functions.php you could add:
    (you will need to use the file name of your front page template)

    function twentytwelvechild_body_class( $classes ) {
    	if ( is_page_template( 'your_page_template_file_name.php' ) ) {
    		$classes[] = 'template-front-page';
    	return $classes;
    add_filter( 'body_class', 'twentytwelvechild_body_class' );


Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic