1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Wordpress custom header isn't doing what I want it to...

Discussion in 'PHP' started by mrShrimp, Jun 18, 2012.

  1. #1
    I'm a beginner programmer, so please excuse any ignorance on my part shown in this post, thank you :p. I created a php file for a header that I only wanted to show on archive pages. I named it header-archive.php appropriately, and it is a copy of the header.php file, except for some things I added. I made a separate .php css sytlesheet, because the featured images shown next to the post excerpts were different in dimensions from each other, and I linked that stylesheet to the header-archive. The header-archive finds the width and height of the featured image like this...

    
    <?php $fimage_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array(450, 165) ); ?>
    <?php $fimage_width = $fimage_data[1]; ?>
    <?php $fimage_height = $fimage_data[2]; ?>
    
    PHP:
    The code finds the dimensions of the first fimage element shown on the archive page, but it sets all of the subsequent fimage elements to the same size instead of finding their own unique size. In other words, the second, third, fourth elements all have the same dimensions as the first. In case it helps, this is the code that links the stylesheet to the header.

    
    <link rel="stylesheet" href="http://www.survivorsite.org/wp-content/themes/custom-community/dynamicstyle.php?param1=<?php echo $fimage_width; ?>&param2=<?php echo $fimage_height; ?>" type="text/css" media="screen" />
    
    PHP:
    Is this code the problem, or is it something else? How can I fix this? Thanks so much!
     
    Last edited: Jun 18, 2012
    mrShrimp, Jun 18, 2012 IP