Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// change thumbnail size
function jetpackchange_image_size ( $thumbnail_size ) {
$thumbnail_size['width'] = 350;
$thumbnail_size['height'] = 200;
// $thumbnail_size['crop'] = true;
return $thumbnail_size;
}
add_filter( 'jetpack_relatedposts_filter_thumbnail_size', 'jetpackchange_image_size' );
// Remove JP Related Posts from its default location
function jetpackme_remove_rp() {
$jprp = Jetpack_RelatedPosts::init();
$callback = array( $jprp, 'filter_add_target_to_dom' );
remove_filter( 'the_content', $callback, 40 );
}
add_filter( 'wp', 'jetpackme_remove_rp', 20 );
add_filter( 'jetpack_relatedposts_post_category_context', 'sk_customize_jp_context', 10, 2 );
function sk_customize_jp_context( $post_cat_context, $category ) {
$post_cat_context = sprintf(
// _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), /* Default */
_x( '%s', 'in {category/tag name}', 'jetpack' ),
$category->name
);
return $post_cat_context;
}
@andpiazza
Copy link

andpiazza commented Apr 5, 2018

Using the first snippet of code (gistfile1.php): how can I tell Jetpack to crop the feature images by 300x300px starting from the top left of the image?

I've used this, to no avail:
function jetpackchange_image_size ( $thumbnail_size ) { $thumbnail_size['width'] = 300; $thumbnail_size['height'] = 300; $thumbnail_size['crop'] = array( 'left', 'top'); return $thumbnail_size;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment