0
我使用wordpress懶惰加載插件https://wordpress.org/plugins/lazy-load/。它適用於帖子&頁面,但自定義帖子類型不起作用,想知道如何將其應用於自定義帖子類型?感謝WP懶惰加載插件自定義帖子類型
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;
}