WordPress.org

Ready to get started?Download WordPress

Forums

PHP Issue in Graphene theme (2 posts)

  1. Zappa365
    Member
    Posted 3 years ago #

    <?php
    if ( is_singular() && has_post_thumbnail( $post->ID ) && ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && $image[1] >= HEADER_IMAGE_WIDTH && !get_option('graphene_featured_img_header')) {
    // Houston, we have a new header image!
    // Gets only the image url. It's a pain, I know! Wish WordPress has better options on this one
    $header_img = get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    $header_img = explode('" class="', $header_img);
    $header_img = $header_img[0];
    $header_img = explode('src="', $header_img);
    $header_img = $header_img[1];
    } else {
    $header_img = get_header_image();
    }

    /*
    * Check if the page uses SSL and change HTTP to HTTPS if true
    *
    * Currently commented out as it causes more trouble than it fixes. If you want
    * to use it, just uncomment it.
    */
    /*
    if (is_ssl() && !stripos($header_img, 'https')){
    $header_img = str_replace('http', 'https', $header_img);
    }
    */

    // Gets the colour for header texts, or if we should display them at all
    if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || '' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR))
    $style = ' style="display:none;"';
    else
    $style = ' style="color:#' . get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) . ';"';
    ?>
    <div id="header" style="background-image:url(images/banner.jpg);">
    <?php if (get_option('graphene_link_header_img')) : ?>
    " id="header_img_link" title="<?php esc_attr_e('Go back to the front page', 'graphene'); ?>"> 
    <?php endif; ?>

    <h1 <?php echo $style; ?> class="header_title"> href="<?php echo home_url(); ?>" title="<?php esc_attr_e('Go back to the front page', 'graphene'); ?>"><?php bloginfo('name'); ?></h1>
    <h2 <?php echo $style; ?> class="header_desc"><?php bloginfo('description'); ?></h2>
    <?php do_action('graphene_header'); ?>
    </div>


    #header{
    background-image:url(images/banner.jpg);
    background-repeat:no-repeat;
    background-color:#000;
    height:280px;
    margin-left:16px;
    width:900px;
    }

    Hi, I am working with the graphene theme.

    I have an issue with the banner - I cant get it to display my own banner, it wants to use the random ones that come with the theme.

    I have tried adjusting the themes CSS (see above), but this doesn't change anything.

    Is there any way to adjust the PHP code so that it will display all my images randomly, with the height and width settings which I have set in CSS?

    Any help on this would be greatly appreciated.

    Thanks:)

  2. Howard Chan
    Member
    Posted 2 years ago #

    I don't understand why you need to touch css when you don't have to.. just go to Appearance >> header >> and upload your desired header image.. image should be 960x198.

    The custom header section also allows you to rotate your uploaded header images. You can definitely choose not to use the default images that came with graphene..

Topic Closed

This topic has been closed to new replies.

About this Topic