Header image vanishes on classified listing pages

Hi,

If you have a look here: http://www.123onlineltd.com/social/classifieds/

You will see the header image is fine (it is one I have uploaded and I am using your BP Colours theme and child themes). The header works fine throughout the site but as soon as you go to a classified listing it reverts back to the themes default header, see: http://www.123onlineltd.com/social/classified/helios-5s-body/

Please advise how I fix this so the uploaded header appears on this page.

Thanks in advance

  • Arnold
    • El Macho WP

    You have more problems than that. Look at it in IE 9 and you don't get it on either page. Put it in compatability mode in IE 9 and the header repeats down the page. So there aer some problems with the template that go beyond the classifieds plugin. You should ask the same question in the templates section.

    Looking at the css it looks like you need a minimum of a no-repeat on the background. You also have two <div> tags with ids of "container" which may be confusing things. You can fix that by editing the single-classifieds.php file in the plugin, there are probably other template files with that problem. Not sure whether Buddy press is throwing in the extra or if it's hte them problem.

  • Cole
    • The Incredible Code Injector

    This issue is somewhere with the custom header and background css that gets injected before the end of the <head> tags.

    #header { background-image: url(http://www.123onlineltd.com/social/wp-content/uploads/2012/05/horsecirclesheader1.png); }
    #header h1, #header #desc { display: none; }

    This isn't a silver bullet fix or anything but I can at least confirm that is the issue. When I use the above css on the page that isn't styled correctly it looks exactly how it should again.

  • Kimberly
    • Champion of Loops

    dillonb,

    We would love to give you a fix in the update! However we are only halfway to finding the issue :wink:

    We now know that it may very well not be a theme issue.

    I'll update Arnold and see if he can take another look, and I believe Cole is looking into it as well!

    Best,

    Kimberly

  • Cole
    • The Incredible Code Injector

    Hey dillonb,

    I have a few things quickly to double check with you.

    What version of classifieds do you have installed? (you can find the version number inside your Plugins->Installed Plugins menu).

    Also could you try to going to Appearance->Header and remove the current one and re-upload the image and save your settings. When I was recreating the issue I noticed after switching from the bp-default over to colors it still showed the custom header image even though it technically shouldn't be there after a theme change.

  • aecnu
    • WP Unicorn

    Greetings Arnold and Cole,

    Thank you both for popping in here and trying to get Dillon squared away with his issues, it is greatly appreciated.

    Kudo's to you guys and I believe Dillon is still awaiting potential progress of resolving the issue.

    Please advise.

    Cheers, Joe

  • Arnold
    • El Macho WP

    As I said before, there's nothing I can do in Classifieds to fix the problem because it's in the Theme. All Classifieds does is display a feature thumbnail image which triggers to problem.

    @dillonb I don't have access to this theme as I work in a different area but if you'll send me an FTP an dWP login to your site I'll take an axe to it and see if I can fix it from here. Email me at arnold at incsub dot com.

  • Arnold
    • El Macho WP

    OK you should be good now. Also got it partially straightened out for IE.

    Problem was a bad pair of IF statements in functions.php for the buddypress function bp_dtheme_header_style(). The original was like this:

    function bp_dtheme_header_style() {
      global $post;
    
      $header_image = '';
    
      if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) {
        $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' );
    
        // $src, $width, $height
        if ( !empty( $image ) && $image[1] >= HEADER_IMAGE_WIDTH )
          $header_image = $image[0];
    
      } else {
        $header_image = get_header_image();
      }
    ?>
    
      <style type="text/css">
        <?php if ( !empty( $header_image ) ) : ?>
          #header { background-image: url(<?php echo $header_image ?>); }
        <?php endif; ?>
    
        <?php if ( 'blank' == get_header_textcolor() ) { ?>
        #header h1, #header #desc { display: none; }
        <?php } else { ?>
        #header h1 a, #desc { color:#<?php header_textcolor() ?>; }
        <?php } ?>
      </style>
    
    <?php
    }

    The problem was the else should belong to the second if above. As written it belongs to the first if and leaves a path where $header_image is never intialized to anything. Properly rewritten it looks like this:

    function bp_dtheme_header_style() {
      global $post;
    
      $header_image = get_header_image();
    
      if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) {
        $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' );
    
        // $src, $width, $height
        if ( !empty( $image ) && $image[1] >= HEADER_IMAGE_WIDTH ){
          $header_image = $image[0];
        }
      }
    
      ?>
    
      <style type="text/css">
        <?php if ( !empty( $header_image ) ) : ?>
        #header { background-image: url(<?php echo $header_image ?>) ; }
        <?php endif; ?>
    
        <?php if ( 'blank' == get_header_textcolor() ) { ?>
          #header h1, #header #desc { display: none; }
        <?php } else { ?>
          #header h1 a, #desc { color:#<?php header_textcolor() ?>; }
        <?php } ?>
      </style>
    
      <?php
    }

    Now $header_image will always have a value unless there's just bad input. Note this is a patch in your copy and if you update it you'll overwrite the patch.

    @KimberlyL
    This glitch is in several of the BP themes including the default BP theme that comes with BuddyPress. Can you get whoever handles that to do the patch on it? Also the CSS filter: in IE 9 overwrites the background image with a gradiant hiding the header image even though it's loaded, so I commented it out.

  • aecnu
    • WP Unicorn

    Greetings dillonb,

    Considering that our lead developer has visited your installation and fixed up the coding I am going to mark this ticket as resolved.

    @Arnold thank you sir for going that extra mile, above the call of duty, and helping this member get his issue squared away.

    @dillionb thank you for being a WPMU Dev Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.