Custom Thumbnail not working
-
Custom thumbnails don’t work well in the latest version 6.2.1. I use template tags and filters. Also vanilla-lazyload.
if ( function_exists( 'wpp_get_mostpopular' ) && ! is_amp() ) { $args = array( 'wpp_start' => '<section><header><h2>' . esc_html__( 'Popular', 'v13' ) . '</h2></header><div class="list">', 'wpp_end' => '</div></section>', 'post_type' => 'post', 'limit' => 6, 'range' => 'last7days', 'taxonomy' => 'post_tag', 'stats_taxonomy' => 1, 'post_html' => '<a href="{url}" title="{title_attr}">{thumb_96}<header><h3>{text_title}</h3><div class="post-meta">{tags}</div></header></a>', ); wpp_get_mostpopular( $args ); }function wpp_thumbnail( $html, $post_id ) { if ( false !== strpos( $html, '{thumb_96}' ) ) { $img_id = 28105; $img = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'thumb96' ); if ( empty( $img[0] ) ) { $img = wp_get_attachment_image_src( $img_id, 'thumb96' ); } $thumb = '<img class="lazy" data-src="' . esc_url( $img[0] ) . '" alt="" width="' . esc_html( $img[1] ) . '" height="' . esc_html( $img[2] ) . '">'; if ( $thumb ) { $html = str_replace( '{thumb_96}', $thumb, $html ); } } return $html; } add_filter( 'wpp_parse_custom_content_tags', __NAMESPACE__ . '\\wpp_thumbnail', 10, 2 );All images are blank,
data-srcdoesn’t change tosrc. All worked fine before 6.2.1. So for now I’m back to 6.1.4. Any suggestion?
Thank’s a lot for your hard work.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Custom Thumbnail not working’ is closed to new replies.
