I'm wondering if anyone knows of a good plugin for Wordpress that displays not only related posts but a tiny thumbnail of an image from the post as well. I've tried this one and I keep getting the same error.
Anyone know of another one I could try?
I'm wondering if anyone knows of a good plugin for Wordpress that displays not only related posts but a tiny thumbnail of an image from the post as well. I've tried this one and I keep getting the same error.
Anyone know of another one I could try?
bbPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND forum_level = 0 AND site_id = 2 AND post_time <= DATE_ADD(now(), INTERVAL 5 ' at line 1]
SELECT topic_id, COUNT(post_id) FROM bb_posts WHERE post_status = 0 AND forum_id = AND forum_level = 0 AND site_id = 2 AND post_time <= DATE_ADD(now(), INTERVAL 5 HOUR) AND post_time >= DATE_SUB(now(), INTERVAL 1 MONTH) GROUP BY topic_id ORDER BY COUNT(post_id) DESC LIMIT 10
Mike
Written Jun. 1, 2008 / Report /
Sorry Mike, nothing comes to mind. Sounds like it might have to be coded by hand.
ldragon
Written Jun. 2, 2008 / Report /
Yeah I think the use of custom fields would be needed, since how are you going to assign a thumbnail to a post? Also, how are the related posts determined, by category, tag etc. I can try and give you a hand if I can get this information.
themikehaynes
Written Jun. 3, 2008 / Report /
Preferably by tag. Anything with a similar tag would be listed as a related entry. I figured it would probably have to be a custom setup. If you're willing to help me out, that would be fantastic.
Anything else you'd need to know?
ldragon
Written Jun. 3, 2008 / Report /
Thing about tags is there could be multiple tags per post, so how should the system decided which tag to use to get related posts?
But I've tried to come up with something, keep in mind this with version 2.5+ . Whilst you're in the loop for the single post, put this bit of code in there somewhere:
<?php$tags = get_the_tags();
$related_tag = array_shift($tags);
?>
$related_tag is now an object which contains information on the first tag of the post.
Now what you do is setting up a query_posts function using the tag information wherever you want the related posts to appear. query_posts does act funny sometimes, so this may not work, but I've tested it and it worked on by system. Anyway, you need to put this code in:
<?php$str = 'tag='.$related_tag->name;
$str.= '&showposts=5';
query_posts($str);
while(have_posts()) { the_post();
### loop things in here e.g. the_title(), the_content()
}
?>
The string we send to the function read like this: tag=cooking&showposts=5. So this finds posts matched to that tag and returns the first first.
If you do have multiple tags, you can make the function search for 'posts with any of these tags', but the query you send to the function is slightly different:
<?php$str = 'tag=';
foreach($array as $tag)
{
$str .= $tag->name.',';
}
$str = substr($str,0,-1);
$str.= '&showposts=5';
query_posts($str);
while(have_posts()) { the_post();
### loop things in here
}
?>
This loops through each format and write the query string like this: tag=bread,butter,jam&showposts=5.
In theory this should work. There are other functions to look for posts with, which I tend to use, such as get_posts() and the WP_Query object, but you can search for tags using them.
If you need to put other parameters into the function, this page tells all about the parameters.
Hope that works, and helps :)