• Resolved enro2002

    (@enro2002)


    Hello everybody
    I´m redesigning my sailing clubs homage. (www.bodoseilforening.org) I wanted rectangular featured images on the front page with customizer. What I did is the following:
    I used the following CSS in my child theme:

    /*remove round divider*/
    .round-div {
    	display: none;
    }
    
    /*change thumbnail size*/
    .thumb-wrapper {
    	display: block;
    	height: 200px;
    	width: 270px;
    } 
    
    .tc-thumbnail.span4 {
    	width: 270px;
    	height: 200px;
    	margin-bottom: 30px;
    }

    I also needed to avoid cropping of the featured images so I copied “class-fire-init.php” to my child theme and changed line nr. 69 to:
    $this -> tc_thumb_size = array('width' => 270 , 'height' => 200, 'crop' => false );

    This does essentially what I want.
    Unfortunately just copying a core file seems not be a very good solution since I do not know what the next customizer update will do to my website. I´m not very good at PHP so it might be a stupid question:
    Is there a better, update proof, way of doing this?
    Thanks
    Enno

Viewing 4 replies - 1 through 4 (of 4 total)
  • I don’t really understand this whole thing around registering WP images.

    However, logic prevails, as ever — and @nikeo add filters, as ever 🙂 — and I see that there is a filter further down, around line 306, which means that this works:

    add_filter( 'tc_thumb_size', 'my_thumb_size');
    function my_thumb_size() {
        $sizeinfo = array( 'width' => 270 , 'height' => 200, 'crop' => false );
        return $sizeinfo;
    }

    This only changes the sizes of new images uploaded into the library. For older images, you will have to use a plugin like Regenerate thumbnails.

    Thread Starter enro2002

    (@enro2002)

    Thank you very much ElectricFeet. This was exactly what I needed. The logic escaped me because I do not understand all this filters and hooks system. Is there any tutorial for dummies? 😉

    No tutorial I know of, but if you look at all the snippets, you gradually pick up what’s happening.

    As a php dummie, I’ve agreed with @nikeo to write something. I’ve started but may take some time to publish.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘rectangular features images without corp.’ is closed to new replies.