I want to pass my google map custom colors from my child theme to my parent theme.
So in my Parent Theme's functions.php I have
add_filter( 'post_thumbnail_html', "map_thumbnail" );
function map_thumbnail($html, $color1, $color2) {
$my_post = get_post($post->ID);
$water_color=$color1;
$tree_color=$color2;
if($my_post->post_name == "contact") {
$html = '<img height="100%" width="100%" src="http://maps.googleapis.com/maps/api/staticmap?watercolor='.$water_color.'treecolor='.$tree_color.'">';
}
return $html;
}
I just want to pass two colors from my child theme's functions.php like so,
$color1 = '#fb0000';
$color2 = '#c0e8e8';
apply_filters('post_thumbnail_html', $color1, $color2);
But unfortunately this is not working. Can anyone help me out here ? I have 3 child themes and all of them have the same map, just the tree color and water color are different. I want to keep the main map_thumbnail function in the parent theme and pass only the individual colors from my child themes. Please help me out if possible.