• Resolved Dburwebby

    (@dburwebby)


    I’m a total beginner in PHP so this might come across as a silly or a basic question here. I came across this plugin because I was running into the issue that I cannot select where I want my feature image cropped for the thumbnail. It seems this allows you to, at least from what it looks like and I understood it to be.

    I have my feature image set at 1400 x 530 and my front page thumbnail as 223 x 335.

    My functions.php:

    add_image_size('banner-image', 1400, 530, true);
     add_image_size('frontPageThumbnails', 223, 335, true);

    This is how I have it currently to appear on the front page in my theme:
    <img class="articleThumbnail img-fluid mx-auto d-none d-md-block pb-4 pb-md-0" alt="" src="<?php the_post_thumbnail_url('frontPageThumbnails'); ?>">

    Is it necessary to have this exact code in the functions.php:

    add_action( 'after_setup_theme', 'my_adjust_image_sizes' );
    function my_adjust_image_sizes() {
        //add an cropped image-size with 800 x 250 Pixels
        add_image_size( 'my-custom-image-size', 800, 250, true );

    Can’t you just have it the way I have where I’m just adding the image sizes? Same with the front page of mine, do I need it in the loop or can I have it the way I currently have it? Again, it may be my lack of PHP knowledge but if the post does have a thumbnail, why have it that way?

    Regardless, I’ve tried it either way, and neither way works for me. Unfortunately, this is in a local server I’m developing this theme so I’m unable to share a live preview of it.

Viewing 1 replies (of 1 total)
  • Thread Starter Dburwebby

    (@dburwebby)

    Never mind, it works. I had to delete the images I already set and re-upload them and crop them again.

Viewing 1 replies (of 1 total)
  • The topic ‘I’m able to crop the thumbnails but not able to view it’ is closed to new replies.