Custom header Image on Each Page (2 posts)

  1. acscom
    Posted 2 years 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
    Theme Author

    Posted 2 years ago #

    Hi acscom

    Please try below code.

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

    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,
    					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


No tags yet.