WordPress.org

Ready to get started?Download WordPress

Forums

raindrops
Custom header Image on Each Page (2 posts)

  1. acscom
    Member
    Posted 1 year ago #

    I am using Raindrops theme,at tex-chl.com. I have two pages that are for hunting I need to have a different header image banner on those two pages, different than for the CHL Pages. How do I do that? I am not familiar with editing php or code on wordpress so things need to be explained pretty clear. Thanks.

  2. nobita
    Member
    Theme Author

    Posted 1 year ago #

    Hi acscom

    Please try below code.

    Add to functions.php first line <?php before.

    <?php
    add_filter( 'raindrops_header_image_css','my_custom_header');
    
    function my_custom_header( $style ){
    /* your settings */
    	$apply_pages = array( 2152 ); // page id or slug or title  ex array( 42, 'about-me', 'About Me And Joe' )
    /* your settings end */
    	if( is_page( $apply_pages ) ){
    	/* your settings */
    		$img = 'http://www.example.com/images/example.jpg';
    		$height = ''; //example value 300px ,if you need height, please add !important
    		$style = 'border:3px solid red;	box-sizing: border-box;'; //ifyou need own style
    	/* your settings */
    
    		$css = '#%1$s{background-image:url(%2$s )!important;height:%3$s;%4$s}';
    		$css = sprintf( $css,
    					'header-image',
    					esc_url( $img ),
    					esc_html( $height ),
    					esc_html( $style )
    					);
    		return $css;
    	}
    
    	return $style;
    }
    ?>

    Thank you.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.