How to replace plugin php via Child Theme

Hi.
I am using a child theme with X Pro and have found a plugin that I need to edit it’s php. While the plugin does not update often, when it does it will overwrite the change I made.
How do I use my Child Theme function.php to replace the edited code with my text?
The plugin is: MB ImageChimp RSS Feed Enhancer.
I am changing the default ‘thumbnail’ image size for the featured image rss feed to be ‘medium’. That’s the only change I am making and it works great.

The code within the mb-imagechimp-rss-feed-enhancer/mb-imagechimp-feed-enhancer.php is:

$img_id = get_post_thumbnail_id($post->ID);
$img_attr = wp_get_attachment_image_src( $img_id, apply_filters(‘mb_rss_extend_item_media_image_size’,‘medium’) );
$img_url = $img_attr[0];
$img_dimension = apply_filters( ‘mb_rss_extend_item_media_image_dimension’, array(‘width’ => $img_attr[1], ‘height’ => $img_attr[2]) );

I assume I need to put some IF statement code in my ‘Pro – Child Theme: Theme Functions (functions.php)’. Probably need to change only one line.
Sorry, I don’t know too much about php and try to keep well away from it.
Any come would be great.

Hi There,

It sounds like you might be having an issue with a third party plugin or script. Regretfully, we cannot provide support for third party plugins or scripts due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer on how you would be able to accomplish the changes you require using the child theme.

Thank you for your understanding.

Hi Jade,
Thanks for the quick response. The plugin itself is an older one and, because it is light-weight and single function, I don’t think it is being updated (or any active support).
However, the only thing I would like to do is use the child theme’s function.php to replace one line of the plugin’s code. I can do this directly within the plugin’s function file, but having the change in the child theme would ‘future proof’ it and be cleaner.
I just don’t know how to use a Wordpress ‘hook’ to preace it:
Replace:

  • apply_filters(‘mb_rss_extend_item_media_image_size’,‘large’) );
    With:
  • apply_filters(‘mb_rss_extend_item_media_image_size’,‘medium’) );

This is what is says on the plugin’s help:

Yes, the url to the featured image is determined by the intermediate size set by the plugin. By default it will request the url for the default ‘large’ size. You can override this by hooking into the ‘mb_rss_extend_item_media_image_size’ filter. Pass the filter either a string or an array as documented in the Codex. You might also want to control the values for the width and height parameters of the image element. By default these are set to “100%” (width) and “auto” (height). This works well with mailchimp for mobile readers. If you want to set these to the actual dimensions of the image you can add the following to your functions.php or a custom plugin:

_add_adction(‘init’,‘my_rss_truedimensions’, 20);
_function my_rss_truedimensions(){
_ remove_filter( ‘mb_rss_extend_item_media_image_dimension’, ‘mb_rss_image_fullwidth’ );
_}

Hi There,

Feel free to add the code on your child theme functions.php file. Then you may adjust 20 from the add_action function. 20 is the priority parameter of the certain function. Increase it for later execution.

Hope this helps.