Missing filters
-
Thanks for a very useful plugin – working as a charm in all kind of installs, by many clients. However, we been missing some filters for a while and would like to request following.
The pinterest output is hard to control. We manage to walk around the lack of description filter, by filter the post meta to belive there is a populated meta for the post. But still, the size of the image cant be filtered, and replacing the url is messy as the attachement_id is commonly delivered by those statements:
$pinterest_img = $this->pinterest_image() ? $this->pinterest_image() : $this->attributes['image'];Where-ever the attributes[‘image’] or pinterest_image() are populated, we would like a filter.
This filter is found:
return apply_filters( 'scriptlesssocialsharing_image_url', isset( $source[0] ) ? $source[0] : '' );Not so useful. We need a filter for the image size before there. And as $id not provided, we must track the image all over again to change the url (if has thumbnail…get_the_ID…attachment_id…get..)
Same for the pinterest own description, a final filter (with all args provided) would be nice:
/** * Get the description for Pinterest. * * @since 2.2.0 * * @return string */ protected function get_pinterest_description() { $pinterest_alt = get_post_meta( get_the_ID(), '_scriptlesssocialsharing_description', true ); if ( $pinterest_alt ) { return $pinterest_alt; } $pinterest_img = $this->pinterest_image() ? $this->pinterest_image() : $this->attributes['image']; $pinterest_alt = get_post_meta( $pinterest_img, '_wp_attachment_image_alt', true ); return $pinterest_alt ? $pinterest_alt : $this->attributes['title']; }In this case we would prefer:
$description = $pinterest_alt ? $pinterest_alt : $this->attributes['title']; $attachment_id = $this->pinterest_image() ? $this->pinterest_image() : $this->attributes['image']; return apply_filters('scriptlesssocialsharing_pinterest_description', $description, $attachment_id, $pinterest_alt, $this->attributes['title']);Thanks – and cheers for all good work!
The topic ‘Missing filters’ is closed to new replies.