I need the following information
– How are you using the Plugin? Widget, shortcode or template function?
– Have you enabled the thumbnail option?
– Does your posts have a featured image?
Thread Starter
Borko
(@media-x)
I’m using the widget,thumbnail enabled,post have the featured image. Everything is working just fine,except the permalink for the image.
Thread Starter
Borko
(@media-x)
Tested it on a clean WP install, with default Twenty Twelve theme, no active plugins and it doesn’t work either.
Okay I know why it is not working now.
I am using this function to get the featured image http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail and it is just printing the image instead of linking it.
I am working on a fix for this. You can track the progress here https://github.com/sudar/posts-by-tag/issues/2
Thread Starter
Borko
(@media-x)
This works:
if ($thumbnail) {
if (has_post_thumbnail($tag_post->ID)) {
$output .= '<a href="' . get_permalink( $tag_post->ID ) . '" title="' . esc_attr( $tag_post->post_title ) . '">'. get_the_post_thumbnail($tag_post->ID, 'thumbnail') . '</a>';
} else {
if (get_post_meta($tag_post->ID, 'post_thumbnail', true) != '') {
$output .= '<a class="thumb" href="' . get_permalink($tag_post) . '" title="' . get_the_title($tag_post->ID) . '"><img src="'. esc_url(get_post_meta($tag_post->ID, 'post_thumbnail', true)) . '" alt="' . get_the_title($tag_post->ID) . '" ></a>';
}
}
}
The code should be cleaned. This is just a draft. But it works.
Yes, this should work. Would you be interested in submitting a pull request at github?
Thread Starter
Borko
(@media-x)
Here we go. posts-by-tag.php @ app. line 728
I replaced this:
if ($thumbnail) {
if (has_post_thumbnail($tag_post->ID)) {
$output .= get_the_post_thumbnail($tag_post->ID, 'thumbnail');
} else {
if (get_post_meta($tag_post->ID, 'post_thumbnail', true) != '') {
$output .= '<a class="thumb" href="' . get_permalink($tag_post) . '" title="' . get_the_title($tag_post->ID) . '"><img src="'. esc_url(get_post_meta($tag_post->ID, 'post_thumbnail', true)) . '" alt="' . get_the_title($tag_post->ID) . '" ></a>';
}
with this:
if ($thumbnail) {
if (has_post_thumbnail($tag_post->ID)) {
$output .= '<a href="' . get_permalink( $tag_post->ID ) . '" title="' . esc_attr( $tag_post->post_title ) . '">'. get_the_post_thumbnail($tag_post->ID, 'thumbnail') . '</a>';
}
Please,can you handle the github part?
Regards
We should handle the other case as well.
I have made the required code change. You can look at it at https://github.com/sudar/posts-by-tag/commit/d2d5a3131bfc9ca55435bf5177f8d102dcc4e051
This will get released in v2.8 of the Plugin.
Marking this thread as resolved. Reopen if you still face any issues.