I want to pass a variable from my child theme function to a filter which resides in my parent theme. Please let me know whether below code will work or not ? Is it the right way ?
Code in Parent Theme's functions.php
add_filter( 'post_thumbnail_html', "map_thumbnail" );
function map_thumbnail($html,$color) {
$my_post = get_post($post->ID);
$my_color = $color;
if($my_post->post_name == "contact") {
$html = '<img src="http://maps.googleapis.com/maps/api/staticmap?color:$my_color">';
}
return $html;
}
Code in Child Theme's functions.php
<?php map_thumbnail('#0099dd'); ?>
Please tell me, will my above code work ? Can I pass the variable $color value$color
from my child theme to parent theme like this ?