Stick to filtering one value at a time to keep it simple, and add filters for the colors to be used by the child theme:
add_filter( 'post_thumbnail_html', 'map_thumbnail');
function map_thumbnail($html) {
$my_post = get_post($post->ID);
$defaultcolor1 = "#??????"; // parent theme default
$defaultcolor2 = "#??????"; // parent theme default
$water_color = apply_filters('water_color',$defaultcolor1);
$tree_color = apply_filters('tree_color',$defaultcolor2);
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;
}
So in the child theme you can use:
add_filter('water_color','custom_water_color');
add_filter('tree_color','custom_tree_color');
function custom_water_color() {return '#fb0000';}
function custom_tree_color() {return '#c0e8e8';}
Related Posts:
- Passing variable from child theme function to parent theme filter
- Override typo in multiple parent theme files?
- Override parent theme function that is not hooked or in the functions.php file
- Can’t get wp_title filter working in twenty sixteen child theme
- How can I remove css from a child theme?
- Filter and modify entry-footer link in twentyseventeen
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Trouble using remove_filter to override function in parent theme
- Why doesn’t this function work when I know that the IP Address is “true”?
- Changing the argument of a function
- output custom Posts on a Page
- Is there a function to edit Blogs contents in Blogs page?
- Override parent theme function that is not hooked or in the functions.php file
- How to remove a filter that is an anonymous object?
- How to add defer=”defer” tag in plugin javascripts?
- No filter of code on switch from html to visual editor, how?
- How to modify posts_where filter only for the search query
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- How to add filter with 2 args?
- WordPress Internal @ Mentions
- Adding revision support to WooCommerce product content
- Changing text within the Block Editor
- Add Class to Specific Paragraph of the_content()
- apply_filters() slices away needed arguments
- Do I need to update the child theme too after updating the parent?
- Search content for shortcodes and get parameters
- How Can I Have A URL Changed Based on the Originating URL?
- Is it possible to Hook/Filters Attachment Creation?
- Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
- Use admin options from parent theme in child theme
- How to hook some Unicode texts into calendar widget safely?
- How to add attributes to tag when template cannot be directly modified
- how to remove filter from wordpress shortcode output
- Change email from and display name with a filter action
- Edit pagination text in the get_the_posts_pagination function
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- Find a Parent Theme’s stylesheet $handle when it registers a stylesheet
- Using the child theme functions.php to change the customizer.php on parent theme
- Where is the changelog for 3.5? where is the list of added removed files?
- apply_filters(‘the_content’) – make it ignore shortcodes?
- When does wordpress process <!–nextpage–>
- Remove style `?ver=` from `/wp-admin/upgrade.php`
- Add attribute to script loaded by the theme
- theme_page_templates not working
- What happens to child theme if I change to new version of parent theme?
- Filter custom post type using multiple taxonomy dropdowns
- Add new post with predefined / preset date
- Remove Actions added by SEO ultimate Plugin
- Remove Extra Classes from Post Title
- Building a request processor for multi-page forms, etc using $_GET requests
- Replace audio links with jplayer using the_content filter
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- Modify Redux Framework Options in Child Theme
- How to allow code block in wordpress comments
- Set default value for “Additional CSS class(es)” for specific block types
- Contact Form 7 Custom Validation Doesn’t Get Called [closed]
- add_filter to wp_nav_menu_objects having no impact
- Trimming a custom field to a length
- How to add a filter to the get_body_class function?
- Using add_filter to modify a public function of a class
- How to hide/remove GhostKit component panel in gutenberg block inspector
- when use function the_content break
- Filter page title (displayed in browser tab) of wp-login
- Adding html banner to posts
- How can I get the default content of WordPress post?
- How do I hide tinymce within the edit screen of a particular page
- How does wordpress add ‘style’ attribute to element
- How do I safely force get_theme_mod() to use a defined get_option(“stylesheet”) value?
- Shortcode / plugin with custom (flexible) output
- Filter “Your latest posts”
- Is it better to use a constant or apply_filter?
- Hide certain product filters from specific product categories
- Hooked into wp_get_attachment_caption to add content to the default description; not working for jetpack slideshow. Why?
- Parent/Child themes – both CSS files loaded
- Add an attribute to the root from functions.php with add_filter
- Would like to use hook or filters to customize email templates
- Removing menus from users other than the administrator
- Can’t understand apply_filter logic
- Plugin function in child theme
- Remove image of srcset
- Modify oembed code conditionally
- Add option to query string before get_posts() is called on archive.php
- Modify wp headers on specific page
- How can I add a prefix to titles displayed in sidebar using function.php?
- List all image sizes still getting disabled sizes
- Strange Theme Error – parent style occasionally showing though child theme
- Why this remove empty paragraphs from the_content does not works?
- Take filter from multiple functions
- wp_editor customization
- What problems could happen if I replaced add_filter and add_action with the function calling
- posts_results filter function memory errors
- Adding to an array & passing it through do_action/apply_filters
- Loading a sidebar on an Ajax call
- the_excerpt() does not work with has_excerpt()?
- Custom excerpt_more filter not working when tag is present
- Taxonomy search filters
- How do you disable the verification process of user email changes?
- Modify the third (context) parameter in a filter?
- Query Multiple Filters, one with Meta
- How to remove a filter that is an object method?