Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1227068

    Hi, on the archive pages for categories, tags, and dates, the tops and bottoms of the image I set for the Featured Image are getting cut off. I included the link in the Private Content section.

    In the Enfold Child Theme Options, under Blog Layout, I chose “Default (Business)” for the Blog Styling, and “Single Author, small preview Pic (no author picture is displayed, feature” for Blog Layout.

    When I inspect these elements using Google Chrome, I see the “class” for the images on the archive pages is “attachment-square size-square wp-post-image”. I assume since this is square it means that the images are being automatically being cropped, which destroys the image I chose for the Featured Image of the post.

    What I want is for the images on the archive pages to use the same class as what’s on the Magazine element page, which has the “class” of “attachment-full size-full wp-post-image”

    Can you tell me how to make the images on the archive pages use the class of “attachment-full size-full wp-post-image” rather than the class of “attachment-square size-square wp-post-image”? I assume this will stop making the images on the archives pages being cut off on the top and bottom.

    The link is in the private section.

    Thank you.

    #1228051

    Hey santanin,
    Sorry for the late reply, I was not able to recreate your archive page layout for testing on my localhost, but your images are cropped, please see the direct link below.
    Try adding this code to the end of your functions.php file in Appearance > Editor to create a new image with the size of 200px X 300px and to not crop.

    add_image_size( 'news-cover', 200, 300, false );
    add_filter( 'image_size_names_choose', 'my_custom_sizes' );
    function my_custom_sizes( $sizes ) {
        return array_merge( $sizes, array(
            'news-cover' => __( 'News Cover' ),
        ) );
    }

    Then copy the file /enfold/includes/loop-index.php and add to your child theme in a new directory /includes/ then edit line 86, look for:

    $size = strpos( $blog_style, 'big' ) ? ( ( strpos($current_post['post_layout'], 'sidebar') !== false ) ? 'entry_with_sidebar' : 'entry_without_sidebar' ) : 'square';

    and change to:

    $size = strpos( $blog_style, 'big' ) ? ( ( strpos($current_post['post_layout'], 'sidebar') !== false ) ? 'entry_with_sidebar' : 'entry_without_sidebar' ) : 'news-cover';

    and then add this code in the General Styling > Quick CSS field or in the WordPress > Customize > Additional CSS field:

    .small-preview {
        width: 200px !important;
        height: 100% !important;
    }

    Then you will need to Regenerate Thumbnails and clear your browser cache and check.
    If that doesn’t help, please include an admin login in the private content area so we can take a closer look.

    Best regards,
    Mike

    #1228280

    Hi! Thank you so much for this information. This worked perfectly. And I noticed I can play around with the CSS styling you provided and change the width now giving m e full control over the image size on the Archive pages! Is this something you may consider adding as a permanent feature? Controlling the size of images on Archive pages is a very beneficial feature.

    I have one additional clarification question. I am using an Enfold Child theme. My question is regarding when Enfold releases updates. I know adding code to the functions.php file is typically safe from upgrades as the file in the Child theme does not get overwritten when you push out an upgrade.

    My concern is over the loop-index.php I needed to edit. I did move this to my Child theme like you recommended. From what I understand about Child themes, when I do upgrade Enfold for the next update you release, I understand that the loop-index.php file in my Child theme will not get overwritten by whatever changes you make to the loop-index.php for your upgrade. This allows me to keep the customizations I made. Is this an accurate understanding so far?

    If so, my question is about any new code or functions you added to the loop-index.php you may have added in the upgrade. Would I not get those on my website because the loop-index.php in my Child theme prevents the hypothetically updated loop-index.php file you just released? I don’t want to miss out on updates in the loop-index.php file, or necessary code edits you needed to make for other parts of a future upgrade to work. Is that something I should be concerned about since I chose to customize the loop-index.php file and add it to my Child theme?

    Thank you,
    Nick

    #1228569

    Hi Nick!

    That is a valid concern and so you will need to keep an eye on that file and every time there is a theme update, you’ll need to copy the fresh copy of the loop-index.php file and make your changes there.

    If you need further assistance please let us know.
    Cheers!
    Victoria

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.