Hi thomos, right now I see the default camera picture on everything twitter related post/sidebar.
Can you give the code that displays that thumbnail in the sidebar?
Pretty sure we can figure this one out 😉
Hi there,
Thanks for the swift reply. I had actually deactivated the plugin temporarily while I searched for a solution.
If you look now, you will see the problem I was referring to in the OP.
The code that displays the thumbnail on the homepage sidebar is:
// Get posts
$posts = get_posts($args);
// Check if we have posts
if ( !$posts ) return '';
// Start posts list
$output = sprintf('<ul id="tab-recent-%s" class="list-recent wpb-tab">', $wid);
// Loop through posts
foreach ( $posts as $post ) {
// Set post id, date, format, link, thumbnail, title
$id = $post->ID;
$date = get_the_time(get_option('date_format'), $id);
$format = 'format-'.get_post_format($id);
$link = get_permalink($id);
$title = get_the_title($id);
$thumb = get_the_post_thumbnail($id, 'size-thumbnail-tabs');
// Set placeholder thumbnail, if none set
if ( !$thumb && $opts['recent-thumb'] ) {
$thumb = sprintf('<img src="%s/img/widgets/tabs-thumb.jpg">',
get_template_directory_uri());
}
// Set classes
$classes = $format;
if ( $thumb && $opts['recent-thumb'] ) $classes .= ' wpb-thumb-enabled';
// Build post list item
$output .= sprintf('<li class="%s group">', $classes);
$output .= sprintf('<a title="%1$s" href="%2$s">', $title, $link);
// Check for post thumbnail
if ( $thumb && $opts['recent-thumb'] ) {
$output .= '<span class="wpb-thumb">';
$output .= $thumb;
if ( in_array($format, array('format-audio','format-video')) )
$output .= '<i class="icon-thumb"></i>';
$output .= '</span>';
}
$output .= '<span class="wpb-text">';
$output .= sprintf('<i class="title">%s</i>', $title);
$output .= sprintf('<i class="meta">%s</i>', $date);
$output .= '</span></a></li>';
}
// End posts list
Also, for some reason, where your plugin is enabled, I’m getting the default image with some completely unrelated text over it displaying on static pages at the top… see here: http://dev.rjthompsonmusic.com/tour/
Any idea why that would be too?
Many thanks for the quick reply.
R
I would suggest not renaming $posts
en $post
.
$post is a global wordpress uses so When you set the $id with $post->ID
It probably uses the global $post which is then overall page.
Let me know!
I shouldn’t really change that because it is all linked into the theme I’m using. It could open a massive can of worms!
Is there nothing I can add/alter with your code?
Can you at least try it?
Just to confirm if this really is the problem?
You can always put it back.
Or just var_dump() the $id? to check if you really get the wrong ID
I’ll give it a go later. If you could be more specific on how exactly to do these things it would be very helpful (I don’t really know php).
In the piece of code change all your $posts
to $sidebar_posts
and $post
to $sidebar_post
And see it it fixes that
I’ve just tried that, and it’s still showing up with the same problem.
Any ideas?
Thanks for the help by the way. Really appreciate it.
sorry for the late response.
For some reason it gets the wrond ID, it most likely isn’t the fault of the plugin. Still I wanna know for sure.
Where is $args
filled? and what is in it there it is going wrong.