I need change the header image on just one page in Wordpress. We're using the ushuaia template, a child theme of wpcasa. It just uses a function.php page for everything. I've tried every plugin and none of them work for whatever reason. So I tried my hand at directly coding the change and added a 'forsale-image' argument to the code. It needs to go on the page 'for sale' or '8062'. Can anyone weigh in on how this should be done? Here's where the header image is created:
add_filter( 'wpsight_custom_header_args', 'ushuaia_custom_header_args', 100 );
function ushuaia_custom_header_args( $args ) {
$args['height'] = 490;
$args['default-text-color'] = 'ffffff';
$args['default-image'] = get_stylesheet_directory_uri() . '/images/header-image.png';
$args['forsale-image'] = get_stylesheet_directory_uri() . '/images/LIV-SIR_BoR_Logo_600w.jpg';
$args['wp-head-callback'] = 'ushuaia_header_style';
return $args;
}
// gets included in the site header
function ushuaia_header_style() {
$header_image = get_header_image();
if( empty( $header_image ) )
return;
?>
<style type="text/css">
#outer {
background: url(<?php header_image(); ?>) no-repeat 30% -220px;
}
</style>
I need change the header image on just one page in Wordpress. We're using the ushuaia template, a child theme of wpcasa. It just uses a function.php page for everything. I've tried every plugin and none of them work for whatever reason. So I tried my hand at directly coding the change and added a 'forsale-image' argument to the code. It needs to go on the page 'for sale' or '8062'. Can anyone weigh in on how this should be done? Here's where the header image is created:
add_filter( 'wpsight_custom_header_args', 'ushuaia_custom_header_args', 100 );
function ushuaia_custom_header_args( $args ) {
$args['height'] = 490;
$args['default-text-color'] = 'ffffff';
$args['default-image'] = get_stylesheet_directory_uri() . '/images/header-image.png';
$args['forsale-image'] = get_stylesheet_directory_uri() . '/images/LIV-SIR_BoR_Logo_600w.jpg';
$args['wp-head-callback'] = 'ushuaia_header_style';
return $args;
}
// gets included in the site header
function ushuaia_header_style() {
$header_image = get_header_image();
if( empty( $header_image ) )
return;
?>
<style type="text/css">
#outer {
background: url(<?php header_image(); ?>) no-repeat 30% -220px;
}
</style>
Share
Improve this question
asked Feb 15, 2020 at 14:46
Shannon DShannon D
1
1 Answer
Reset to default 0You want to use the following:
if (is_page( 806 ) ) {
// Your code for that page here
}