First thumbnail bigger with post excerpt
-
Can you please help me to make the first thumbnail with different dimensions than other and to have post excerpt only in the first post.
Thanks.
-
Any solutions?
It doesn’t show the widgets I published, and the footer is gone.
That sounds like a PHP error. Could you please describe what you did? Did you follow the instructions I posted on this topic?
Hello Hector.
I update the plugin to newwest version on my website https://pletenje
I have problem with the small thumbnails. In functions.php I add 290, 200 on big one and 100, 70 for the smaller, but it crop them different.
Can you please help me?
Here is the code
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 = "<a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\">" . get_the_post_thumbnail( $popular->id, array(300, 200), array('alt' => esc_attr($popular->title), 'title' => esc_attr($popular->title), 'class' => 'wpp-thumbnail-first') ) . "</a>"; $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: 22px;\">{$popular->title}</a>{$excerpt}</li>"; } else { // Regular output $thumbnail = "<a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\">" . get_the_post_thumbnail( $popular->id, array(100, 70), array('alt' => esc_attr($popular->title), 'title' => esc_attr($popular->title), 'class' => 'wpp-thumbnail') ) . "</a>"; $output .= "<li>{$thumbnail} <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 );
Hello Hector.
I updated the plugin to newest version on my website https://pletenje
I have problem with the small thumbnails. In functions.php I add 290, 200 on big one and 100, 70 for the smaller, but it crop them different.
Can you please help me?
Here is the code
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 = "<a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\">" . get_the_post_thumbnail( $popular->id, array(300, 200), array('alt' => esc_attr($popular->title), 'title' => esc_attr($popular->title), 'class' => 'wpp-thumbnail-first') ) . "</a>"; $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: 22px;\">{$popular->title}</a>{$excerpt}</li>"; } else { // Regular output $thumbnail = "<a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\">" . get_the_post_thumbnail( $popular->id, array(100, 70), array('alt' => esc_attr($popular->title), 'title' => esc_attr($popular->title), 'class' => 'wpp-thumbnail') ) . "</a>"; $output .= "<li>{$thumbnail} <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 );
Hello Hector.
I updated the plugin to newest version on my website https://pletenje
I have problem with the small thumbnails. In functions.php I add 290, 200 on big one and 100, 70 for the smaller, but it crop them different.
Can you please help me?
Here is the code
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 = "<a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\">" . get_the_post_thumbnail( $popular->id, array(300, 200), array('alt' => esc_attr($popular->title), 'title' => esc_attr($popular->title), 'class' => 'wpp-thumbnail-first') ) . "</a>"; $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: 22px;\">{$popular->title}</a>{$excerpt}</li>"; } else { // Regular output $thumbnail = "<a href=\"{$permalink}\" title=\"" . esc_attr($popular->title) . "\">" . get_the_post_thumbnail( $popular->id, array(100, 70), array('alt' => esc_attr($popular->title), 'title' => esc_attr($popular->title), 'class' => 'wpp-thumbnail') ) . "</a>"; $output .= "<li>{$thumbnail} <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 );
I’m guessing the plugin is showing the cached versions of your thumbnails. Go to Settings > WordPress Popular Posts > Tools and use the Empty image cache button to clear it so WPP recreates them again.
- The topic ‘First thumbnail bigger with post excerpt’ is closed to new replies.