• Resolved ChristopherScott

    (@christopherscott)


    When I upload images while using the Decode theme, the maximum image width is 640px. When viewed on a standard-resolution monitor, the width of the text is usually larger than that — around 770px. As a result, images in the body of any post appear too narrow. See this post as an example — both galleries and individual images are under-sized.

    I have set the width for large images to 1024px under Settings > Media, but the large size for any image I upload ends up being maxed out at a width of 640px (although height can be greater). Some research suggests that this is happening because the theme sets $content_width to 640px. I have reviewed the theme’s functions.php file and do not see $content_width being set anywhere; perhaps this is being inherited from a parent theme?

    I should note that I am not asking to increase the actual width of content displayed to a user (which could be done in CSS). I am asking for the ability to not have the large image size restricted to a width of 640px by the theme’s settings.

    I have reviewed the forum, but have not seen a post on the same topic; my apologies if this is duplicative. I am running the stock, up-to-date version of Decode (v.3.0.9). This issue relates to media images inserted into the post itself, and not to the header image (which is handled differently).

Viewing 3 replies - 1 through 3 (of 3 total)
  • I came here for exactly this problem!

    I have tracked the culprit to a change in the way the developer sets the content width.

    Previously, he had done it using $content_width and he had set it so it was customizable and I had overridden that in my child functions.php file.

    Now he’s using a function called decode_content_width which is not optional.

    I found a way around it by adding this to my child theme’s functions.php:

    function remove_decode_content_width() {
        remove_action( 'after_setup_theme', 'decode_content_width', 0 );
    }
    add_action( 'after_setup_theme', 'remove_decode_content_width' );
    
    function content_width() {
    	$GLOBALS['content_width'] = apply_filters( 'decode_content_width', 790 );
    }
    add_action( 'after_setup_theme', 'content_width', 10 );

    *790 is my preferred width

    Since I don’t know anything about php or really understand how WordPress really works, this is probably akin to killing a mosquito with a sledgehammer, so if anyone would care to show me something more elegant, I’m open to it. ??

    Thanks!

    Thread Starter ChristopherScott

    (@christopherscott)

    That is tremendously helpful! I’ve added that code (although I’ve adjusted the width to 1024px) and resized all of my site’s thumbnails; all images now display properly. I haven’t noticed any issues with the rest of the site’s layout after implementing the fix.

    It would be ideal if the theme itself were updated to correct this behaviour. Since it breaks basic WordPress functionality, I think it’s fair to consider it a bug. For now, I’ll have to use a child theme to force this fix.

    I haven’t yet marked this topic as resolved since the theme itself still has this issue. Hopefully we’ll hear back from the developer.

    Hi guys,

    just commenting on this thread to let you know we’re going to be including this in our next update.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Maxiumum image width is too narrow’ is closed to new replies.