Hi Aldo!
I can see in the source code that Soil adds a function to the wp_calculate_image_srcset filter. RWP disables the native responsive images solution in order to work, so I guess that’s why Soil is not working properly.
Thread Starter
Aldo
(@ab_lu)
Thanks a lot for the feedback!
What are the main differences from your plugin and the native responsive images solution apparat from the backend interface?
I don’t know actually. I haven’t really tried out the native solution since it still was a separate plugin.
RWP has both a ‘native mode’ and a ‘Picturefill mode’. It also supports the picture element, which the build in solution doesn’t do.
I think the greatest advantages is the helper functions RWP offers. rwp_style() and rwp_attributes() is powerful functions which is easy to forget. They gives the developer the possibility to really customize the responsive images.
Thread Starter
Aldo
(@ab_lu)
Thanks for your feedback 🙂
I’l stay with RWP and check with the Soil Plugin devs for a resolution.
One last question.
Do you know of a guide for a best approach in determining all the needed image sizes for a site?
No, the image sizes I use myself can be very different from site to site. It just depends on the layout. I usually starts with looking at the smallest and largest possible image in the layout. For example, I might set large to be as wide as the widest column can be on the site.
Depending on breakpoints, I use medium somewhere in between thumbnail and large along with custom sizes.
It just depends I think!
Thread Starter
Aldo
(@ab_lu)
Yeah, I though so 😉
Regarding the issue with soil.
I also checked the code and there is the filter who makes the replacement.
Is there a way to disable the filter if RWP is active?
add_filter('wp_calculate_image_srcset', function ($sources) {
foreach ($sources as $source => $src) {
$sources[$source]['url'] = \Roots\Soil\Utils\root_relative_url($src['url']);
}
return $sources;
});
Thread Starter
Aldo
(@ab_lu)
Just got a feedback from the Soil developers:
Soil is adding a filter onto the built-in wp_calculate_image_srcset. It’s pretty bad for a plugin to remove that filter itself which responsify is doing.
Is there any way as mentioned in the post before to just disable the filter if RWP is activated?
Sorry for the late reply!
RWP has to disable the native wp_calculate_image_srcset filter in order to work. I can’t see any way to disable the filter that Soil is adding I’m afraid.
One way to check if RWP is active is to look for the rwp_img() function for example.
<?php
if ( function_exists('rwp_img') ) {
// Do something when RWP is activated.
}
?>
Thread Starter
Aldo
(@ab_lu)
Thanks for the reply!
I’ll end up removing the code in soil manually.
Okey! It’s always hard to make two plugins that affect the same thing work good together. One plugin often needs to adapt to the other, the question is which one…
Anyway, I’m sorry we couldn’t find the perfect solution in this case!
Thread Starter
Aldo
(@ab_lu)
No problem.
Appreciate your fast support.
BTW. Just came across another issue in the admin section under “Image sizes”:
Notice: Undefined index: medium_large in /Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/admin/views/selected_sizes.php on line 23
Notice: Undefined index: medium_large in /Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/admin/views/selected_sizes.php on line 24
Notice: Undefined index: full in /Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/admin/views/selected_sizes.php on line 23
Notice: Undefined index: full in /Volumes/Data/WEB/HTDOCS/site/web/app/plugins/responsify-wp/admin/views/selected_sizes.php on line 24
Any idea?
Thanks
Aldo
It seems like WordPress has medium_large and full registered as image sizes, but they are still not available in some way… Do you know if there’s something special going on with those two sizes?
Another compatibility issue with Soil maybe? Have you experienced this before on sites that doesn’t have that plugin?
Thread Starter
Aldo
(@ab_lu)
Nothing special.
I even disabled Soil and the Notices still appear.
Something with the theme maybe? Which one are you using?
Thread Starter
Aldo
(@ab_lu)
No, I’m using the standard WP theme (Twenty Fifteen).