Okay
  Public Ticket #1603247
Max Width for Home Page Images
Closed

Comments

  •  10
    jonnymnemonic started the conversation

    Hi Paul,

    I have another question. Is there any way to change the max width of the home page images? It could be in the customization options, but I didn't see anything there. Thanks!

    Best,

    Jon

  •  291
    Paul replied

    Hi Jon,

    In this case, you would need to customize it with the following steps:

    1. Increase the max width of the ".content-width" CSS class using custom CSS (it's set to 1280px by default)

    2. Create a child theme for this customization (please check out this article for how-to: https://uxbarn.ticksy.com/article/8649/ )

    3. Put this code into the "functions.php" file of the child theme:

    function enso_register_theme_image_sizes() {
            
            add_image_size( 'enso-full-width', 1280, 9999 );
            add_image_size( 'enso-port-list', 9999, 600 );
            add_image_size( 'enso-port-single-portrait', 600, 9999 );
            
        }
    

    It is the function that the parent theme is using for setting up the image sizes. You can adjust the width value of the "enso-full-width" here to be more than 1280.

    4. Re-upload the featured image of your portfolio items, or use this plugin to regenerate them all: https://wordpress.org/plugins/regenerate-thumbnails/ (the images' width needs to be larger than the new width you just adjusted already.)

    I hope it helps.

    Regards,
    Paul

  •  10
    jonnymnemonic replied

    Thanks again Paul!

    Sorry for the late reply. I am currently traveling so I'm busy running around. I will try to the code in a little bit and let you know how it goes!

    Best,

    Jon

  •  10
    jonnymnemonic replied

    Hi Paul,

    I think I followed the instructions correctly and the child theme was able to change the maximum width of the image! Thank you!!

    The problem, as you can see in the attached image, is that the text does not align with the image. Rather, it pushes my image to the left (rather than having it be centered) and the text itself falls to the right. Anyway to fix this?

    Cheers,

    Jon

  •  291
    Paul replied

    Hmm. Did you already increase the width of the "enso-full-width" image size in the code as mentioned previously and re-upload the featured images?

    For example, if you increase the maximum width of the ".content-width" to "1500px", you would also need to adjust the "enso-full-width" to:

    add_image_size( 'enso-full-width', 1500, 9999 );

    Then make sure that the image you are going to use is wider than 1500px. After uploading the featured image, WordPress then can generate the 1500px width image and it will be displayed on the front end and should fit the new max width of the content area.

  •   jonnymnemonic replied privately
  •  291
    Paul replied

    I just checked your homepage and it looked like this: https://cl.ly/sJCg

    It seems both text and image are all in place now. So did you already manage to solve the issue?

  •  10
    jonnymnemonic replied

    Hi Paul,

    Weird! Mine doesn't look like that on my end. I tried viewing it from Chrome first, and then I tried Safari. Both still show it as the previously attached photo. 

    I've noticed that if my browser window is not maximized, then they appear to be in place. However, once I maximize the browser window, then the photo moves to the left and the text moves to the right.

    Cheers,

    Jon

  •  291
    Paul replied

    Ah I found it. Please try this code:

    .content-width {
        max-width: 900px;
    }
    

    It should help.

  •  10
    jonnymnemonic replied

    Hi Paul,

    Yes, it worked!!! THANK YOU!!! AHHH!

    Cheers,

    Jon

  •  10
    jonnymnemonic replied

    Hi Paul,

    Sorry for another question, but I hope this one will be easier to answer. Is it possible to change the content-width for my blog images, home page images, and portfolio images separately? In other words, is it possible, say, to make the blog content-width a max width of 800px, the home page content-width a max width of 1280px, and the portfolio images content-width a max width of 2560px?

    I'm trying to figure it out myself, but I'm not having any luck.

    Thanks!

    Best,

    Jon

  •  10
    jonnymnemonic replied

    I've attached a couple of images in case I'm not being clear!

  •  291
    Paul replied

    You can do that by using different class names for those specific pages. For example, to adjust the content-width of only the homepage, you can use it like this:

    .home .content-width {
        ...
    }

    Or for blog pages:

    .blog .content-width,
    .single-post .content-width {
        ...
    }

    To find the class name for each page, you can use the Chrome's Developer Tools for that. Just look at the "body" tag of each page and you will find it.

    Please see here for more info about the Developer Tools: https://uxbarn.com/inspecting-elements-developer-tools/

  •  10
    jonnymnemonic replied

    Woohoo! Thanks Paul! I will go ahead and try it out now!!

    Best,

    Jon

  •  10
    jonnymnemonic replied

    Yes it worked!!

    Now I am trying to get it to work for what would be my new home page. For some reason, there appears to be a div.post-content-container.clearfix thing that is preventing the masonry gallery from taking up the entire width of the page. I've attached an image. I'm not sure if that's the issue though. Do you know how to possibly get rid of this div (or if you have another solution)?

    How exciting!

    Best,

    Jon

  •  10
    jonnymnemonic replied

    OMG I somehow fixed it!!