[wp-hackers] Passing arguments to filter functions.

Satish Gandham satish.iitg at gmail.com
Mon Feb 28 08:01:39 UTC 2011


Below is my code

I'm looking for a way to pass size value to get_the_image() function.

----------

add_filter( 'post_thumbnail_html', 'swift_post_image_html', 10, 3 );

function swift_post_image_html( $html, $post_id, $post_image_id ,$attr) {
    if( $html !=''){
        print_r($attr);
        $html = '<a href="' . get_permalink( $post_id ) . '" title="' .
esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html .
'</a>';
        return $html;
    }
    else{
        return get_the_image( array( 'echo' => false, 'size' =>'' ) );
    }
}


More information about the wp-hackers mailing list