understrap / understrap-child

The starter child theme for Understrap, the renowned open-source WordPress starter theme.
GNU General Public License v3.0
582 stars 332 forks source link

Best way to set image sizes in Understrap? $content_width? #307

Closed currentcreative closed 3 years ago

currentcreative commented 3 years ago

EDIT: I figured it out.

  1. Yes, I should use the standard image sizes code in functions.php as explained in this this Issues thread.
  2. The $content_width global variable is something used for plugins, etc. to be helpful and can basically be ignored for my purposes.
  3. I have no idea where the CSS Grid Containers code came from originally, but I won't worry about it now. Perhaps it is created when the project compiles or something.

Original flailing questions below for other dumdums and noobs like me...

After a bit of looking, I found the $content_width global in inc/setup.php so I tried to find this in the Understrap docs to see everything it might affect, but I didn't find anything in the docs.

I read this $content_width approach can be pretty standard in modern themes, but I've never used it.

Is it still advisable to set up thumbnails sizes as discussed in this Issues thread?

Should we just leave $content_width at 640? When I change $content_width in inc/setup.php to 730 instead of 640, my featured images become 730px wide as I would like, rather than 640px, since my main content area is 730px wide.

The 730px width of my content area is determined by the #content .container div which is 1140px, so I searched my theme for 1140 and see that this is determined by this CSS in my _child_theme.scss:

// Grid containers
//
// Define the maximum width of '.container' for different screen sizes.

$container-max-widths: (
  sm: 540px,
  md: 720px,
  lg: 960px,
  xl: 1140px
) !default;

@include _assert-ascending($container-max-widths, "$container-max-widths");

...but I have no idea where that came from. I didn't come up with those. It came from somewhere in Understrap, but I don't see it in the repos anywhere.

My main content area and right sidebar sizes are determined by standard Undestrap classes. The #primary div just has classes of col-md content-area and the #right-sidebar has classes of col-md-4 widget-area. It's a super bare bones Understrap install and the main content area is 730px rather than 640px, so I'm a little confused because it's just those basic classes that give it the 730px width...and yet the $content_width global in inc/setup.php is set to 640. I guess I just really don't understand what the $content_width global is supposed to do.