• Hello!
    Help me please.
    I use the plugin WP Favorite Posts.
    I would like to add a thumbnail to each Favorited item in the widget, I’ve tried the below code:
    echo get_the_post_thumbnail( $o->post_id, thumbnail);
    In line 210 in the wp-favorite-posts.php

    function wpfp_list_most_favorited($limit=5) {
        global $wpdb;
        $query = "SELECT post_id, meta_value, post_status FROM $wpdb->postmeta";
        $query .= " LEFT JOIN $wpdb->posts ON post_id=$wpdb->posts.ID";
        $query .= " WHERE post_status='publish' AND meta_key='".WPFP_META_KEY."' AND meta_value > 0 ORDER BY ROUND(meta_value) DESC LIMIT 0, $limit";
        $results = $wpdb->get_results($query);
        if ($results) {
    
            echo "<ul>";
            foreach ($results as $o):
                $p = get_post($o->post_id);
    
                echo "<li>";
                echo "<a href='".get_permalink($o->post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a> ($o->meta_value)";
                echo "</li>";
            endforeach;
            echo "</ul>";
        }
    }

    But for some reason it doesn’t work.
    Help me please

  • The topic ‘Thumbnails in widget (WP Favorite Posts)’ is closed to new replies.