WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Jetpack Photon and Custom field images

[Resolved] Jetpack Photon and Custom field images

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeremy Herve

    @jeherve

    You should be able to edit your theme to make sure the images are called via Photon when it’s activated. You can follow the instructions here to do so:
    http://jetpack.me/2013/07/11/photon-and-themes/

    Yes, but i don’t know how to implement with my shortcode, custom field, to display the images through the Photon CDN. All images from my site are displayed by this
    Shortcode:
    <?php myabp_print_thumbnail(85, 85); ?>
    85, 85 = width, height

    Custom field:
    mabp_thumbnail_url
    my site is jocurihd.com

    Like this?

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

    Plugin Author Jeremy Herve

    @jeherve

    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 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Jetpack Photon and Custom field images’ is closed to new replies.