Skip to content

Instantly share code, notes, and snippets.

@imath
Created July 19, 2022 05:26
Show Gist options
  • Save imath/84678e53db7ac2fe36e7ac589cea6c8b to your computer and use it in GitHub Desktop.
Save imath/84678e53db7ac2fe36e7ac589cea6c8b to your computer and use it in GitHub Desktop.
Force the full size featured image to be used by the BP Media Extractor for `new_blog_post` activity types (See BP Trac ticket 8052)
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Force the full size featured image to be used by the BP Media Extractor for `new_blog_post` activity types.
*
* @see https://buddypress.trac.wordpress.org/ticket/8052 for the context.
* @see https://codex.buddypress.org/themes/bp-custom-php/ to learn how to add the `bp-custom.php` file into your WP site.
*/
function teeboy4real_new_blog_post_extractor_args( $args = array(), $content = '', $activity = array() ) {
if ( isset( $activity['type'] ) && 'new_blog_post' === $activity['type'] ) {
unset( $args['width'] );
}
return $args;
}
add_filter( 'bp_activity_create_summary_extractor_args', 'teeboy4real_new_blog_post_extractor_args', 10, 3 );
/*
* You'll also need to add a new css rule to your theme's styles:
* `.activity-list .activity-item.new_blog_post .activity-inner img { max-width: 100%; }`
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment