• Resolved Daniel Ruyter

    (@dbruyteryahoocom)


    Greetings,

    I’m using JP 3.5.3 and have a question on customizing the display of related post thumbnails. From what I’ve read, I understand the images are resized via Photon. I’d really like to increase the size of my images and have them span the width of the div (making them more prominent on the page – I have a photography blog).

    I’ve added the following to my functions.php file to customize the look:

    //* JetPack related posts
    // show 2 related posts
    function jetpackchange_howmany_related_posts( $options ) {
        $options['size'] = 2;
        return $options;
    }
    add_filter( 'jetpack_relatedposts_filter_options', 'jetpackchange_howmany_related_posts' );
    
    // change thumbnail size
    function jetpackchange_image_size ( $thumbnail_size ) {
    	$thumbnail_size['width'] = 700;
    	$thumbnail_size['height'] = 467;
    //	$thumbnail_size['crop'] = true;
    	return $thumbnail_size;
    }
    
    function jetpackme_related_posts_headline( $headline ) {
    $headline = sprintf(
                '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>',
                esc_html( 'Here are a few other posts:' )
                );
    return $headline;
    }
    add_filter( 'jetpack_relatedposts_filter_headline', 'jetpackme_related_posts_headline' );
    
    add_filter( 'jetpack_relatedposts_filter_post_context', '__return_empty_string' );

    Here’s a link to a post: https://www.dadtography.com/introducing-dadtography-social-photo-platform-dads-families/

    Can someone assist in resizing the images? I think once that’s done I can adjust the CSS on my own, as needed.

    Thank you!

    -Daniel Ruyter

    https://www.ads-software.com/plugins/jetpack/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    You’re on the right track, but it seems you haven’t hooked your thumbnail size changes to the jetpack_relatedposts_filter_thumbnail_size filter yet.

    Try this:

    function jetpackchange_image_size ( $thumbnail_size ) {
    	$thumbnail_size['width'] = 700;
    	$thumbnail_size['height'] = 467;
    	return $thumbnail_size;
    }
    add_filter( 'jetpack_relatedposts_filter_thumbnail_size', 'jetpackchange_image_size' );

    I hope this helps.

    Thread Starter Daniel Ruyter

    (@dbruyteryahoocom)

    Hi Jeremy – yes, your filter absolutely fixed it for me. I knew it was something minor. Thanks for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Resize Related Post Thumbnails Span Width’ is closed to new replies.