[Plugin: Featured Page Widget] get_the_featured_post_image forgets the optional post_id parameter
-
Function get_the_featured_post_image($post_id = NULL) uses function calls like get_the_title() and has_post_thumbnail(), without using the conveyed post_id parameter.
Here’s a patch for fixing that.
Index: template_tags.php =================================================================== --- template_tags.php (revision 556335) +++ template_tags.php (working copy) @@ -29,12 +29,12 @@ $height = $_wp_additional_image_sizes[$this_instance['thumbnail_size']]['height']; } $content.= '<img src="' . $postimage . '" width="' . $width . '" height="' . $height . '" border="0" class="align' . $this_instance['imagealign'] . ' fpw-image-' . $this_instance['imagealign'] . '" />'; - } elseif ( function_exists('has_post_thumbnail') and has_post_thumbnail() and $this_instance['useimageas'] == 'image' ) { - $content.= get_the_post_thumbnail($post_id, $this_instance['thumbnail_size'], array('title' => get_the_title(), 'class'=>'align'. $this_instance['linkalign'])); + } elseif ( function_exists('has_post_thumbnail') and has_post_thumbnail($post_id) and $this_instance['useimageas'] == 'image' ) { + $content.= get_the_post_thumbnail($post_id, $this_instance['thumbnail_size'], array('title' => get_the_title($post_id), 'class'=>'align'. $this_instance['linkalign'])); } if ( $content != '' ) { - return '<a title="' . get_the_title() . '" href="' . get_permalink() . '">' . $content . '</a>'; + return '<a title="' . get_the_title($post_id) . '" href="' . get_permalink($post_id) . '">' . $content . '</a>'; } else { return false; } @@ -143,4 +143,4 @@ echo get_the_featured_post_read_more_link($post_id); } -} \ No newline at end of file +}
https://www.ads-software.com/extend/plugins/featured-page-widget/
- The topic ‘[Plugin: Featured Page Widget] get_the_featured_post_image forgets the optional post_id parameter’ is closed to new replies.