- This topic has 6 replies, 2 voices, and was last updated 4 years, 2 months ago by Tom.
-
AuthorPosts
-
February 23, 2020 at 7:15 pm #1174801Dan
Hello
I have the blog layout in my homepage.
It’s displaying the featured image.
The problem is that it’s taking a very large image, 2000X1500px for example, and reducing the width to 370X270.
Still, the file loaded is the large one, taking up a lot of loading time.
Is there a setting so that the theme takes the medium sized thumbnail and not the large or full size for the blog archive layout? at least when the display in the archive is 2 or 3 columns?
Something inline with the functionthe_post_thumbnail('medium')
Thanks
DanFebruary 23, 2020 at 7:43 pm #1174811DanI added this filter, but I don’t see any change:
add_filter( 'generate_blog_image_attributes','tu_variable_image_sizes' ); function tu_variable_image_sizes( $atts ) { // Set up our conditional if ( is_front_page() ) { $atts[ 'width' ] = 400; $atts[ 'height' ] = 400; $atts[ 'crop' ] = true; } // Return our options return $atts; }
February 24, 2020 at 9:21 am #1175473TomLead DeveloperLead DeveloperHi there,
Try this:
add_filter( 'generate_page_header_default_size', function( $size ) { if ( ! is_singular() ) { return 'medium'; } return $size; } );
Let me know ๐
February 24, 2020 at 9:31 am #1175481DanHi Tom, Thanks.
Since I’m using the ‘sider’ site, what would be the best practice in creating a child theme for that site – so I can edit the functions.php file?
Or would I add it via Elements?Thanks
DanFebruary 24, 2020 at 9:35 am #1175487TomLead DeveloperLead DeveloperYou can use this plugin if you’re not using a child theme: https://wordpress.org/plugins/code-snippets/
You can also use a child theme like you normally would, regardless of using the Site Library ๐
February 24, 2020 at 9:47 am #1175503DanOK, got it sorted out, exported the customizer settings (with this: https://wordpress.org/plugins/customizer-export-import/), created the child theme and then imported the customizer settings.
Shouldn’t the theme set a thumbnail size (medium/large) to the blog posts featured images by default? This could save some serious bandwidth and loading speeds.Another question related to the blog archive – when setting the infinite scroll, is there a way to add a spinner or loading icon to display to the users while the other posts are loading?
Thanks
DanFebruary 24, 2020 at 5:53 pm #1175814TomLead DeveloperLead DeveloperWe actually do have options to resize your featured images, but we’re removing them in 1.10 in favor of the standard WP way of doing things.
As for the spinner, this might help: https://generatepress.com/forums/topic/adding-a-loading-spinner-to-infinite-scroll/#post-929728
-
AuthorPosts
- You must be logged in to reply to this topic.