Quantcast
Channel: WordPress.org Forums » [Jetpack - WP Security, Backup, Speed, & Growth] Support
Viewing all articles
Browse latest Browse all 36992

Jeremy Herve on "[Plugin: Jetpack by WordPress.com] Jetpack Photon and Custom field images"

$
0
0

You should start by adding the following to your theme's functions.php file:

if( function_exists( 'jetpack_photon_url' ) ) {
    add_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10, 3 );
}

Then, locate the function that is creating the image tag from the Custom Field value. It will include something like this:

get_post_meta($post->ID, 'mabp_thumbnail_url', true)

Now, you will need to add jetpack_photon_url and the size in there, like so:

$args = array(
    'resize' => '85,85',
);
$image_url = jetpack_photon_url( get_post_meta($post->ID, 'mabp_thumbnail_url', true), $args );

$image_url might have a different name, so this will depend on your theme. But the idea is to wrap get_post_meta into the jetpack_photon_url function, and to add the image size there.


Viewing all articles
Browse latest Browse all 36992

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>