WP Lazy Load 插件自定义 Post 类型

WP Lazy Load Plugin Custom Post Type

我正在使用 wordpress 延迟加载插件 https://wordpress.org/plugins/lazy-load/。它适用于 post 页面,但自定义 post 类型不起作用,想知道如何将其应用于自定义 post 类型?谢谢

add_filter( 'lazyload_images_placeholder_image', 'my_custom_lazyload_placeholder_image' );
function my_custom_lazyload_placeholder_image( $image ) {
 return 'images/preloader.gif';
}

这是我的尝试,但不确定该怎么做:

add_filter( 'lazyload_images_placeholder_image', 'my_custom_lazyload_placeholder_image' );
function my_custom_lazyload_placeholder_image( $image_src, $image ) {
    $image_src = 'images/preloader.gif';
    return $image_src;
    $post_types = $post_types = array( 'post', 'video_library', 'example1_posts', 'example2_posts', 'example3_posts', 'example4_posts', 'example5_posts', 'example6_posts');
    $image->set( 'post_type', $post_types );
    return $image;
}

没关系,我已经将 CPT 图像设置为

$attachment = wp_get_attachment(get_post_thumbnail_id($post->ID)); $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 650,350 ), false, '');

我改成下面的,现在可以用了。似乎此插件未设置为支持上述获取 post 缩略图的方法。

the_post_thumbnail('full', array( 'class' => 'img-responsive' ) );