Support » Fixing WordPress » twenty twelve custom page template

  • Twenty-twelve child theme
    site = pinetreeschool.org
    A series of pages on this site need their own look so I am working on a custom page template to use when I create each page. I would like the pages in the series to have identical headers and header images unique to this series. I’ve manged this for a single page based on the default template using a conditional statement (pinetreeschool.org/?page_id=325) in page.php. Can I automate this by using a custom template?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    possibly try working with the conditional tag http://codex.wordpress.org/Function_Reference/is_page_template

    Thank-you alchymyth. My 1st clumsy attempt seems to work. Unless you see anything else, I shall mark this resolved.

    /*the following conditional statements test a page to determine which header to use. The 1st condition, if true, displays the reading header image. If false, (elseif) it tests for a 2nd condition which also displays the reading header image. If 2nd condition is false, it displays the default custom header image which we use for all other pages on the site*/
    		<?php $header_image = get_header_image();
    		if (is_page('Read Every Day')) :
    		echo '<a href="' . esc_url( home_url( '/' ) ) . '"><img class="header-image" src="http://www.pinetreeschool.org/wp-content/uploads/2014/03/headerreading-copy.jpg" alt="" /></a>';elseif (is_page_template('bookreview.php')) :
    		echo '<a href="' . esc_url( home_url( '/' ) ) . '"><img class="header-image" src="http://www.pinetreeschool.org/wp-content/uploads/2014/03/headerreading-copy.jpg" alt="" /></a>';
    		elseif( ! empty( $header_image ) ) : ?>
    			<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    		<?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘twenty twelve custom page template’ is closed to new replies.