-
AuthorPosts
-
February 2, 2022 at 11:01 am #1338413
Hey folks,
in the Blog Post Element (Blog Grid) I can go to Styling > Appearance > Preview Image Size and choose out of a list of image sizes the size I need. But that is not possible for the Blog itself.
In the Blog Settings I set “Blog Grid” for my Blog Layout but it uses “portfolio” as image size. That size is used on the archive pages. For the Blog itself I use a Blog Post Element with image size set to “featured_large”.
Can I change the default image size for the normal Blog Layout (used on archive pages)? Or can I somehow use the same settings and look of a Blog Post Element for all archive pages? Right now I have to style the Blog Post Element (for the normal Blog Page) and the “Blog Grid” (for archive pages).
Would be great to hear where to set the image size (in my child theme). Thanks!
And since we talk about archive pages already: Is it possible to load an header image for them? Enfold with WooCommerce has it built in for product categories so it should be possible for other archive pages as well – am I wrong? I have a CPT with a Custom Taxonomy where I can set images but I need to load them in the archive.php, how can I do that?
Best regards,
DanielFebruary 3, 2022 at 9:30 am #1338637Hey spooniverse,
Thank you for the inquiry.
Yes, you can adjust the thumbnail size in the archive pages by editing the archive.php file directly or by using the avf_post_slider_args filter.
add_filter("avf_post_slider_args", function($args, $context) { if( $content == "archive" ) { $args["preview_mode"] = "custom"; $args["image_size"] = "full"; } return $args; }, 10, 1);
These are the available thumbnail sizes.
square featured featured_large portfolio portfolio_small gallery magazine masonry entry_without_sidebar entry_with_sidebar shop_thumbnail shop_catalog shop_single shop_gallery_thumbnail
Adding an image to category template is possible but it will require significant amount of modifications. If you want to check how it has been implemented for the product categories, look for the avia_woo_edit_category_fields and the avia_woo_add_category_fields functions in the enfold/config-woocommerce/admin-options.php file. The functions are attached to thse hooks.
// https://developer.wordpress.org/reference/hooks/taxonomy_edit_form_fields/
// https://developer.wordpress.org/reference/hooks/taxonomy_add_form_fields/The actual banner function is in the enfold/config-woocommerce/config.php file.
Best regards,
IsmaelFebruary 3, 2022 at 10:03 am #1338646Hey Ismael, thank you for your information. Will try some things with the header image.
Now back to the archive page image size:
You write you can adjust the thumbnail size in the archive pages by editing the archive.php file directly. I already searched for a function loading the
portfolio
size but did not find it. Where do I find the line to change? The filter you sent is for functions.php but I would like to change the size in the archive.php directly and don’t now where exactly.Thanks for helping me out!
February 3, 2022 at 11:13 am #1338657Hey!
The filter you sent is for functions.php but I would like to change the size in the archive.php directly and don’t now where exactly.
The filter above will actually adjust the arguments in the archive.php file. You don’t have to edit the template file directly. But if you are curious where to adjust the postslider arguments or attributes in the archive.php file, just look for this code around line 56.
$atts = array( 'type' => 'grid', 'items' => get_option('posts_per_page'), 'columns' => 3, 'class' => 'avia-builder-el-no-sibling', 'paginate' => 'yes', 'use_main_query_pagination' => 'yes', 'custom_query' => array( 'post__in' => $post_ids, 'post_type' => get_post_types() ) );
You can add and set the preview_mode attribute to custom and specify the image_size .
Cheers!
IsmaelFebruary 3, 2022 at 12:11 pm #1338671Found the place. I added the excerpt there alyready like:
'contents' => 'excerpt_read_more',
How do I add the preview_mode? Like that:
'preview_mode' => 'featured_large',
Or do I miss something?
February 4, 2022 at 6:04 am #1338813Hi,
You have to set the preview_mode to custom, then specify the image_size that you want to use.
'preview_mode' => 'custom', 'image_size' => 'featured_large',
Best regards,
IsmaelFebruary 4, 2022 at 3:20 pm #1338914Thanks for helping me out, Ismael. You may close this.
February 5, 2022 at 4:47 am #1338988Hi,
Great, I’m glad that Ismael could help you out, and thanks for the update. I’ll close this thread for now then, please open a new thread if you should have any further questions or problems.
Best regards,
Rikard -
AuthorPosts
- The topic ‘Set image size for Blog Grid’ is closed to new replies.