WordPress.org

Forums

Adamos
Add an image to the header on ONE page (5 posts)

  1. Afwodicker
    Member
    Posted 1 year ago #

    Need some coding help!!

    I have eliminated the header image on several pages In order for the content to be more "viewable" by not having to scroll down. Please see the link below.

    http://testsite.ionictransport.com/?page_id=8

    I would like to insert the logo, which is currently on the top of the page, into the header. But just on that page. I need some coding help on this one.

  2. I have eliminated the header image on several pages

    how?
    please show the coding.

    on ONE page

    consider coding a conditional statement based on is_page() http://codex.wordpress.org/Function_Reference/is_page

  3. Afwodicker
    Member
    Posted 1 year ago #

    I added the following lines to the style.css

    .page-id-8 .site-header img {display: none;}
    .page-id-6 .site-header img {display: none;}

    If I use the is_page code how would I phrase it for an image and where would I place it?

    /* =Media
    ---------------------------------------------- */

    .site-header img,
    .entry-content img,
    .comment-content img,
    .widget img {
    max-width: 100%; /* Fluid images for posts, comments, and widgets */
    }

    .page-id-8 .site-header img {display: none;}
    .page-id-6 .site-header img {display: none;}

  4. If I use the is_page code how would I phrase it for an image and where would I place it?

    in header.php - ideally in a child theme - change this line:

    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo get_theme_mod( 'adamos_logo' ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"></a>

    to:

    <?php if( is_page('the_one_with_header') ) { ?>
            <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo get_theme_mod( 'adamos_logo' ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"></a>
            <?php } ?>

    if you also need the header on index pages and archive pages, you will need to expand this conditional statement <?php if( is_page('the_one_with_header') ) { ?> for instance to <?php if( is_page('the_one_with_header') || is_home() || is_archive() ) { ?>

    http://codex.wordpress.org/Conditional_Tags

  5. NH Broere
    Member
    Posted 1 year ago #

    Question: where in the stylesheet did you ad:

    .page-id-8 .site-header img {display: none;}

    ?

    I'm trying to remove the headers image from certain pages, but i dont know where exactly to put this code. I tried several spots in the style.css...

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic