Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1060468
    pruzicka
    Participant

    Hi,
    is this (https://www.smashingmagazine.com/2015/12/responsive-images-in-wordpress-core/) implemented in X ? When I upload image to WP, it would create several images with different size but I’ve found out that WP would use only one (the biggest one) for featured image and for the one used in post. Also this size would be used for all viewports, mobile or biggest screen in my house.
    Is this how it’s supposed to work ?
    Thanks

    Petr R.

    #1060733
    Rad
    Moderator

    Hi Peter,

    Thanks for writing in.

    That feature is disabled on X theme. X theme uses its own registered image sizes due to the nature of theme’s responsiveness. But if you wish to enable it, please add this code to your child theme’s functions.php

    function x_disable_wp_image_srcset( $source ) {
      return true;
    }

    Thanks!

    #1061541
    pruzicka
    Participant

    Hi Rad,
    thanks a lot. I’ve done that but I see no change šŸ™ cache cleared etc.). What exactly is should do ?

    Petr

    #1061609
    Thai
    Moderator

    Hey There,

    Please add the following code instead:

    function x_enable_srcset( $source) {
    	return true;
    }
    add_filter( 'wp_calculate_image_srcset', 'x_enable_srcset' );

    Hope it helps šŸ™‚

    #1062246
    pruzicka
    Participant

    Thank you, once again, I see no change.

    #1062733
    Lely
    Moderator

    Hi There,

    Please use this code instead:

    function x_disable_wp_image_srcset( $source ) {
      return true;
    }

    Hope this helps.

    #1063323
    pruzicka
    Participant

    Hi Lely,
    isn’t this the code from the first response ?

    Petr

    #1063330
    Joao
    Moderator

    Hi Petr

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks

    Joao

    #1063402
    pruzicka
    Participant
    This reply has been marked as private.
    #1063653
    Darshana
    Moderator

    Hi there,

    Please refer to the following detailed response here (https://community.theme.co/forums/topic/enable-srcset/#post-1043395).

    Thanks!

    #1063799
    pruzicka
    Participant

    Interestingly enough, page not found. I’ve tried to find it via search, got the hit bust still – page not found. But thanks for hint anyway.

    Petr

    #1064338
    Christopher
    Moderator

    Hi there,

    I’m sorry the thread is private, I put answer here :

    The responsive srcset feature from WordPress was disabled with intent and much decision weighing things out as we have had our own responsive image calculations in place for X that take into account things that WordPress cannot due to the nuances of the theme. That being said, we can understand that you may wish to utilize this feature, even though we do not currently support it. For now, you will need to leave your fix in place in the core files of the theme, but in the next release we have made this function ā€œpluggableā€ so that you can overwrite it via your child theme. When the next release is out, if you go to /functions/global/admin/thumbnails/setup.php you will see at the bottom of the file this block of code:

    if ( ! function_exists( 'x_disable_wp_image_srcset' ) ) :
      function x_disable_wp_image_srcset( $source ) {
        return false;
      }
      add_filter( 'wp_calculate_image_srcset', 'x_disable_wp_image_srcset' );
    endif;

    Again, this will be in the next release, not this current one. To overwrite this when the update is out, you can add your own x_disable_wp_image_srcset() function to your child theme’s functions.php file, which will keep this one from disabling the responsive srcsets. That might look something like this in your child theme:

    function x_disable_wp_image_srcset( $source ) {
      return true;
    }

    Simply overwriting the function should also remove the add_filter call from X as that is also wrapped inside the if statement.

    Do keep in mind that this is not a feature we support in X, so enabling responsive srcsets again means that we will not be able to assist in any formatting or functional issues that might arise because of this, but we want to make sure that you at least have a clean way to do this via your child theme if desired. Hopefully this helps and don’t hesitate to let me know if you have any further questions.

    Hope it helps.

    #1064360
    pruzicka
    Participant

    great, thanks a lot

    Petr

    #1064379
    Nico
    Moderator

    Happy to hear that.

    Feel free to ask us again.

    Thanks

  • <script> jQuery(function($){ $("#no-reply-1060468 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>