Maybe I should specify: I need only the first post thumbnail to be shown.
Hi there,
You already posted here, so there’s no need to create a new topic. I’m requesting a mod to close/delete this one.
Actually this is a separate topic for a new poster, and that’s what we ask people to do 🙂 Better to ask here in a non-resolved topic we feel.
I guess you have a point. Alright then, I’ll let it be.
To the OP, I have already replied on the other topic so please make sure you go there first.
Sorry Hector for all the confusing regarding your side, but I thought It would be wiser to open a new thread about it.
I followed your guide, and I succeeded to make thumbnails: 1 larger for first element and two others a bit smaller. Tho, I would like to ask you, if there’s a way, to only have 1 large thumbnail for first post, and others should only contain titles of posts. If I try to tinker the code you provided, I end up only with same thumbnails for all posts 😀
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 🙂
Thank you for your patience, as I am just a starter :/
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?
Since the OP hasn’t replied in a week now, I’m marking this topic as resolved.
@neofalinas if you require further help with the code I posted above, please let me know.