0

I want to use two images in the header. In the home page and single.php is the image I've uploaded in the panel (named logo.png). For pages I want use the image 'logopage.png' (directory: /images/logopage.png).

Just the image I'm using in home page is working. In the pages nothing appears.

How can I do that?

Ps.: The code I'm trying to use:

function.php:

add_theme_support( 'custom-header', array(
  'default-image' => get_template_directory_uri() . '/images/logo.png',
  'random-default'         => false,
  'width'                  => 1050,
  'height'                 => 100,
  'flex-height'            => true,
  'flex-width'             => true,
  'default-text-color'     => '',
  'header-text'            => false,
  'uploads'                => true,
  'wp-head-callback'       => '',
  'admin-head-callback'    => '',
  'admin-preview-callback' => '',
));

In the header.php:

  <?php
  if ( is_home() ) echo theme_heading();
  if ( is_single() ) echo theme_heading();
      elseif ( is_page() ) get_template_directory_uri() . '/images/logopage.png';
  ?>

Sorry my english :X

  • What theme are you using? – Brad Dalton Aug 28 '14 at 13:42
  • I'm using a theme created by myself. – user52466 Aug 28 '14 at 13:44
  • 1
    looks like you are missing an echo for the is_page() condition – Mark Kaplun Aug 28 '14 at 15:27
1

I got it!

<?php if (  (is_home()) || (is_single())  ) { ?>
<?php echo theme_heading(); ?>
<?php } elseif (is_page()) { ?>
<img src="<?php echo get_stylesheet_directory_uri() ?>/images/logopage.png" />
<?php } ?>

Thanks to everyone!

  • Link to the source of the code please. – Brad Dalton Aug 28 '14 at 16:09
  • I just tried different ways, and I came to this result alone. – user52466 Aug 28 '14 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.