Advertisement
Guest User

csleh

a guest
Oct 28th, 2010
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. This is the if/else code I'm using to apply different headers to sections:
  2.  
  3. <?php
  4. if ( is_page('about-us') || $post->post_parent == '6' ) {
  5. // the page is "About", or the parent of the page is "About"
  6. echo '<img src="' . get_bloginfo('template_directory') . '/images/1784461-penchart.png" />';
  7. } elseif ( is_page('what-we-do') || $post->post_parent == '8' ) {
  8. else {
  9. }
  10. ?>
  11. <?php if (is_front_page()) { ?>
  12. <img src="<?php bloginfo('template_directory'); ?>/images/detroit.png" alt="Detroit Michigan" />
  13. <?php } else if (in_category('links')) { ?>
  14. <img src="<?php bloginfo('template_directory'); ?>/images/Arc.jpg" />
  15. <?php } else { ?>
  16. <!--creating a phantom image for some reason so this is commented out -->
  17. <!-- <img src="<?php bloginfo('template_directory'); ?>/images/mu.jpg" /> -->
  18. <?php } ?>
  19.  
  20.  
  21. and this is the code from twenty ten header.php I'd like to modify to show different headers based on section, UNLESS a page has a featured image, in which case I'd like that to show.
  22. <?php
  23. // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  24. if ( is_singular() &&
  25. has_post_thumbnail( $post->ID ) &&
  26. ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
  27. $image[1] >= HEADER_IMAGE_WIDTH ) :
  28. // Houston, we have a new header image!
  29. echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  30. else : ?><!-- this is where I tried changing so there were defaults based on category, but the site kept breaking-->
  31. <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
  32. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement