Skip to content

Instantly share code, notes, and snippets.

@jeherve
Last active March 1, 2016 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeherve/b026862701798ce5673f to your computer and use it in GitHub Desktop.
Save jeherve/b026862701798ce5673f to your computer and use it in GitHub Desktop.
[Themify Ultra / Jetpack's Photon module
<?php
/**
* The theme appears to be using its own function, `themify_get_image()`, to build image URLs used to display images above posts.
* It can grab image details (like dimensions) from custom fields in each post,
* and then builds a custom HTML output based on parameters you can add to the function.
*
* Photon won't be able to support that, so they'll need to make these images don't get processed by Photon at all.
*
* Add the following to a functionality plugin to force Photon to ignore such images
*/
function jetpackme_themify_stop_photon() {
$photon_removed = remove_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ) );
}
add_action( 'themify_before_post_image', 'jetpackme_themify_stop_photon' );
function jetpackme_themify_reenable_photon() {
if ( $photon_removed ) {
add_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ), 10, 3 );
}
}
add_action( 'themify_after_post_image', 'jetpackme_themify_reenable_photon' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment