Resizing thumbnails in a child theme
-
Hello,
This code is responsible for displaying thumbnails in the post archive. I discovered that if you specify the exact dimensions in the admin panel and rewrite this code, you can achieve the desired and exact size of the photos to display them in the theme.
But the problem is that after copying the file to the child theme where this code is located, the code does not work. It needs to be written somehow differently.
For example, in the function.php file.
How to do it?Full code from \wp-content\themes\zakra\inc\template-tags.php
if ( ! function_exists( 'zakra_post_thumbnail' ) ) : /** * Displays an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. */ function zakra_post_thumbnail( $image_size = 'post-thumbnail' ) { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } ?> <div class="zak-entry-thumbnail"> <?php if ( is_singular() ) : the_post_thumbnail(); else : ?> <a class="zak-entry-thumbnail__link" href="<?php the_permalink(); ?>" aria-hidden="true"> <?php the_post_thumbnail( $image_size, array( 'alt' => the_title_attribute( array( 'echo' => false, ) ), ) ); ?> </a> <?php endif; // End is_singular(). ?> </div><!-- .zak-entry-thumbnail --> <?php } endif;From this code
function zakra_post_thumbnail( $image_size = 'post-thumbnail' )to this code
function zakra_post_thumbnail( $image_size = 'thumbnail' )
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Resizing thumbnails in a child theme’ is closed to new replies.
