Overwrite a specific function in child theme
-
Hello,
what’s the best way to overwrite a specific function in a php file of a parent theme? I mean a specific php file, that isn’t the functions.php file.
In my case, I need to change the default image that appears in slider if there isn’t a featured image. This is the code in my_actived_theme/includes/theme-plugins.php:
// If there is no image, use the default image (available filter: mag_post_image_none). if (isset($attachment[0])) { $post_image_uri = $attachment[0]; } elseif ( 'slider' == $size ) { $post_image_uri = apply_filters( 'mag_slider_image_none', get_template_directory_uri() . '/images/no-image.jpg' ); } else { $post_image_uri = apply_filters( 'mag_post_image_none', get_template_directory_uri() . '/images/no-image-small.jpg' ); } // If no image, return now if ( $post_image_uri == apply_filters( 'mag_slider_image_none', get_template_directory_uri() . '/images/no-image.jpg' ) || apply_filters( 'mag_post_image_none', get_template_directory_uri() . '/images/no-image-small.jpg' ) ) return $post_image_uri; // If MU/MS install, we need to dig a little deeper and link through the blogs.dir. if ('IS_MU') { $imageParts = explode('/files/', $post_image_uri); if (isset($imageParts[1])) { $post_image_uri = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1]; } } return $post_image_uri; } endif;
So how can I edit this code? (in my example, I need to change the image url).
I hope my English is clear. :/
Thanks in advance! ??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Overwrite a specific function in child theme’ is closed to new replies.