Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Harish Chouhan

    (@hchouhan)

    Hey @ckwing03,

    Yes, that is possible but will require some custom code. Can you please tell me whether you are using a Block theme or a normal theme?

    Thread Starter ckwing03

    (@ckwing03)

    I use Indice

    Plugin Author Harish Chouhan

    (@hchouhan)

    Hey @ckwing03,

    Please try using this code via a child theme’s “functions.php” file or you can use a 3rd party plugin like “Code Snippets” to add this code.

    /**
    * Add thumbnail to each item in [dot_recommended_top_posts] or [irecommendthis_top_posts].
    */
    add_filter( 'irecommendthis_top_post_link', function ( $link_html, $item, $permalink, $post_title ) {
    $post_id = $item->ID;

    $thumb = has_post_thumbnail( $post_id )
    ? get_the_post_thumbnail(
    $post_id,
    'thumbnail',
    array(
    'class' => 'irecommendthis-top-thumb',
    'alt' => $post_title,
    'loading' => 'lazy',
    )
    )
    : '';

    // Build custom HTML with thumbnail and title inside link
    return sprintf(
    '<a href="%1$s" title="%2$s" class="irecommendthis-top-post-link">%3$s<span class="irecommendthis-top-title">%4$s</span></a>',
    esc_url( $permalink ),
    esc_attr( $post_title ),
    $thumb,
    esc_html( $post_title )
    );
    }, 10, 4 );

    Please not that this will not styling anything. For that you will need to add custom styling.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘show thumbnail’ is closed to new replies.