Skip to content

Instantly share code, notes, and snippets.

@psflannery
Created October 16, 2013 09:15

Revisions

  1. psflannery created this gist Oct 16, 2013.
    14 changes: 14 additions & 0 deletions jetpack_fallback_image.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    function jeherve_custom_image( $media, $post_id, $args ) {
    if ( empty( $media ) ) {
    $permalink = get_permalink( $post_id );
    $url = apply_filters( 'jetpack_photon_url', 'YOUR_LOGO_IMG_URL' );

    return array( array(
    'type' => 'image',
    'from' => 'custom_fallback',
    'src' => esc_url( $url ),
    'href' => $permalink,
    ) );
    }
    }
    add_filter( 'jetpack_images_get_images', 'jeherve_custom_image', 10, 3 );