Don’t worry about it, we are all learning here.
Alright, to have the plugin display a thumbnail only for the first post change the custom_popular()
function into this:
function custom_popular( $mostpopular, $instance ){
$counter = 0;
$output = '<ul class="wpp-list">';
foreach( $mostpopular as $popular ) {
$permalink = get_permalink($popular->id);
$excerpt = "";
// Different output for the first post: show different thumbnail and post excerpt (summary)
if ( 0 == $counter ) {
$thumbnail = get_the_post_thumbnail( $popular->id, array(300, 200), array('alt' => esc_attr($popular->title), 'title' => esc_attr($popular->title), 'class' => 'wpp-thumbnail') );
$excerpt = " <span class=\"wpp-excerpt\">" . get_excerpt_by_id( $popular->id ) . "</span>";
$output .= "<li>{$thumbnail} <a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\" style=\"font-size: 18px;\">{$popular->title}</a>{$excerpt}</li>";
} else { // Regular output, no thumbnail
$output .= "<li><a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\">{$popular->title}</a>{$excerpt}</li>";
}
$counter++;
}
$output .= '</ul>';
return $output;
}
add_filter( 'wpp_custom_html', 'custom_popular', 10, 2 );
Bonus: I would like to have a border of some sort, so it would be visually easier to read the content of this amazing plugin ??
What do you mean?