A Better Related Posts Plugin
There are many plugins that find related posts for WordPress, and I was happy to use one of them in the past. However, WordPress evolves. One of the biggest change was the addition of custom post types. They are very useful and I use them a lot for my own and for client sites. And this is where every related posts plugin I tested failed: They don't support custom post types.
While reviewing the code of several plugins I decided that the Right Thing would be to write a new plugin from scratch. And that's what I did. Key features:
- Depends on PHP5 and MySQL5
- Option to add related posts to the RSS feed
- You can theme the output as you like
- Use fulltext indexes for good performance
- Does caching through post meta, this means zero additional database queries
- Incremental scoring for sites with many posts
- Find related posts, pages and custom post types
- Use different configurations at the same time, useful for different post types
- Internationalized, OO, hopefully well documented and readable
- Score relationships by various MySQL relevance scores or term relationships
Use tags, categories or custom taxonomies
The readme.txt contains extensive documentation. It is possible to create completely custom views of related content, including post thumbnails, date, excerpts etc.
Downloads are available at WordPress.org.
WordPress plugin demos are disabled as I don't use WordPress on this site any more.
I've downloaded and activated this plugin but it's not showing up on my pages. Am I missing something??
Well I figured out how to make it on the post BUT it's showing 8 queries in 0.0966 seconds, current offset 0 after the words Related Content. How do I get rid of that and the numbers after the related post link??
You can turn this information off on the options page. It is only displayed to logged in admins, not all visitors.
i've activated this plugin on WPMU and i get error :
"There is no fulltext index for wp_1_posts.post_content"
"There is no fulltext index for wp_1_posts.post_title"
Am I missing something?
Oh, did you perform a network activation of the plugin? I guess that would trigger the error on all blogs but the one you activated the plugin on.
Which MySQL version are you running? The fulltext index should be created at plugin activation, and IIRC the plugin checks for the indexes every time you access the options page.
If you did a network-wide activation please try again with the current trunk version: http://wordpress.org/extend/plugins/better-related/download/ (trunk should appear in a few minutes)
thanks nicolas, I am very pleased and will patiently wait
Just getting started with this plugin and I need to know what values the multiplier fields take? is it just 0/1 or up to where? Need a bit more info on this...
They are simply integers and there's no limit. Actually, I should probably make them floats...
ok, thx. just wondering as by default two fields had 1 the rest had 0... will experiment a bit... I guess everyone has figure out his own values depending on what he uses most, categories/tags/etc..
ok, now totally confused. I read above: The scoring methods... so it seems the multiplier fields are not used at the same time?
Where do I select a scoring method?
Each scoring method has it's own multiplier, that you can set on the options page. Setting it to 0 will disable that scoring method. Use the_related_analyze(); to analyze which scoring methods are relevant for you. Hide that from normal visitors on the frontend though, use current_user_can().
I really don't understand. what do you mean relevant? I think all are relevant I just need to assign them a particular score depending on how goo the results they yield are? So if a particular scoring method gives me good results I raise its score, right? maybe lower or disable those that don't give good results and be happy with the resulting mix?
btw. what are keywords? meta-keywords?
Please check the readme.txt. If things aren't clear there I will update the documentation.
I seem to be having some problems with the automatic injection into pages. the pages where I have hte problem, all have some sort of shortcode, either gallery shortcodes or other ones in them... it works for pages without shortcodes though. And I know there is related content because I used he_related_analyze(); to check it out...
I have never seen this problem.
Please disable or delete all plugins and switch to the default theme. The default theme in WordPress 3.0.x is Twenty Ten. After making these changes does the problem still occur?
If not, switch the plugins on one by one and tell me which one creates the problem, I'll have a look.
Hello, I got 2 posts in the same category. On the newer post the older one is under "Related Posts". But on the older posts the newer one doesn't appear. How do I make this work?
Hi Patrick, you can lower the score necessary to display results or show more related posts. The relevance score varies, depending on which direction the relatedness tests are performed.
Thanks for your advice. Lowered it to about 35 and it works now. :)
Ok, great! I'm currently working on a new feature to set related posts manually as well. Hope to release it soon.
Best, Rico
hey, I am very glad to have found your plugin. it looks awfully useful, especially given all the fine tuning between post content, title, category and such!
– my problem:
I have included "" in my sidebar. while the plugin shows "related" posts under the single post, it at the same time says "no related" in the sidebar...
... can you help? thanks!
PS: “” meaning the php-template-tag
Hi oliver, I assume you meant the_related() ? You can pass the post ID as first parameter in the sidebar, that should work.
thanks for the feedback, Nicolas!
– but this hasn´t changed the display.
...at least if you were meaning taking out the »get_the_ID(),« line of the call-function. still I get the "no related" in the sidebar, though results are there with the same code-lines [including the ID call] in the body...
[on the sidetrack: still what the parameters of what I put in the sidebar actually do control is the display-behavior of the "automated display in post"-function if that setting is turned on... so there seems to be something going on in the background... :-}]
PS: … what actually happens when I take out the ID-line, is that the sidebar display switches to the heading filled-in in the custom-presets section of the plugin (even though automatic display for posts is turned off there)
I have the same problem and still no solution
Please keep in mind that I can't see your code, I don't really know what you are trying to do. It's probably filtered away because you used php tags.
http://codex.wordpress.org/Function_Reference/get_the_ID : This tag must be within The Loop.
Hello! I tried to install this plugin using WP Admin and through FTP too, but It keeps showing:
There is no fulltext index for wp_posts.post_content
There is no fulltext index for wp_posts.post_title
What can I do to fix it? Thanks!
Hi, I think this is a bug. I've just released 0.4.3 which should hopefully fix this problem. you need to deactivate the plugin and activate it again.
A simple
ALTER TABLE wp_posts ENGINE = MyISAM;
then disabling and reenabling the plugin fixes this right up.
Hi Nicolas! I did the upgrade (deactivated and them the upgrade), but the error remains. I also tried the SQL do create the fulltext, but error again:
Query : CREATE FULLTEXT INDEX content_index ON wp_posts (post_content)
Error Code : 1214
The used table type doesn't support FULLTEXT indexes
What should a do now? Thanks
Ah, I see. Your MySQL tables aren't using the MyISAM storage. Are you the database admin? If yes, it might be possible to change the storage engine, see <a href="http://dev.mysql.com/doc/refman/5.1/en/alter-table.html" rel="nofollow">this page</a>.
MyISAM is the default storage engine for MySQL. I guess I could build engine detection into the plugin and create new tables if necessary... but this would create quite some overhead. I'll look into this for the next release, but at the moment I think it's rather unlikely I will add such a feature.
Interestingly, the plugin appears to still work in the frontend...
should I be concerned about performance (or security?) issues if this error message persists in the backend?
Thanks,
I did the change, now It's MyISAM and the error n plugin's page disappeared, but all posts from my custom post_type "Eventos" keeps showing "No related content found."
I'm using almost all the default configuration values, look: http://awesomescreenshot.com/09f3ksl22
This plug-in looks great !
However I've got the same problem than ubas for my blog :
http://windows-mobile.fr
Could you help me please ?
Best regards
I've installed 0.4.3 (from scratch as I've just discovered your plug-in ;-) ) but I've got the same issue...
Which MySQL version are you running? It has to be 5 at least.
If you are on v5 try to run the command "CREATE FULLTEXT INDEX content_index ON wp_posts (post_content);" in phpmyadmin or another mysql client. Do you get an error, if yes which?
excellent plugin.
however, how do i stop the current article being the first related post? i don't want users going round an endless loop.
my current article always has a score of around 51000, and is always displayed as the first related post. all following articles are between 125 and 50 (my min score setting).
i would like to list "other" related pages, and not say "you might like to read the article you're already reading. it's relevelant!" ;)
thanks for your help.
Hmmmm, that's odd. How is the list generated on your site? Do you just use the built-in auto-add feature? This shouldn't be happening.
Tag to Taxonomy Multiplicator okay, but why not Category to Taxonomy Multi? If I got two posts with the tag "action" then they are linked. Fine. But if I got two posts of the same category (some posts have more than one cat, dont know if thats a problem) then they should also appear. They do not. Only if I go down to 10 % match and then it shows too much stuff.
Yes, there's room for improvement for the term to term relationship scoring. I plan to work on that for the 0.5 release.
It's "Term to taxonomy multiplier" btw, and should probably be called "Term to term multiplier", so it applies to tags, categories and any custom taxonomies.
Personally, I don't think that just sharing a category should make a post related automatically, but that's what the Term to tax multiplier is for, you can set it to something higher.
Could you give an example of your manual inclusion code that defines a specified custom post type and custom taxonomy please?
For the life of me I can't figure out how to modify the manual inclusion code to specify the custom post type and custom taxonomy that it should use.
The section "How to use different configurations at the same time" in the readme is all you need. The plugin will use the custom taxonomy your post type uses anyway. The usetax parameter is only for searches across different taxonomies, I assume you don't need that?
Thanks Nicolas. I tried the code you mentioned (below) and it works. But it's not a loop, so I can't add thumbnails to my related recipes. Is there a way with this plugin to make a custom loop that <a href="http://codex.wordpress.org/Custom_Post_Types#Querying_by_post_type" rel="nofollow">queries a custom post type?</a>
'if ( function_exists( 'the_related' ) ) { the_related(
get_the_ID(),
array(
'usept' => array(
'recipe' => true
),
'storage_id' => 'better-related-recipe'
)
);
}'
Seriously? Did you miss the "How to build a custom loop of related posts" section? Just add your post type to $args.
That last sentence is what I needed. We're not all programmers. Of course I saw the section, hence my original question of how to define the custom post type to use. And the answer is to add your custom post type to $args. Thx.
Great :-)
Hi Nicolas. I've implemented your great plugin, but in the results i see private declared articles too. Thats realy not good. Ok, the articles are not accessible for the users without the rights, but i do not want, that the headers are showed in my public area.
how i can prevent this? Is a secret option available for this?
best regards
Michael
Hi Michael. No, this is not configurable at the moment, but I will add this feature in the next release.
If you're comfortable with PHP you could edit lines 300 and 463 in inc/scorer.php to exclude them from the SQL query as a quick fix.
Hi Nicolas,
I have a quick question that your plugin may cure but I'm not sure, I was hoping you could give me some insight.
On this page http://waterworks-lamson.com/authorized/ I have an "authorized dealer" search plugin set up that when you type the state in the search box "california" it will return the results (post)california then you have to click on that to get to the post.
I would like to bypass the results page that you need to click on and go directly to the post. Is this possible?
And..... I would like to only have the search on this (page).
I hope you can help.... boy do I need it!
Thank you for your time!
Brent
Well, I think that should be possible, but it depends a little on how your site was coded. I assume you had somebody build it for you, you could just ask that person to look into this or you can use my contact form if you're interested in hiring me :-)
Hello Nicolas,
I am trying to display custom post type thumbnails, but I can't get this to work.
Could you tell me how to re-write frontend.php (L. 480...) to display my custom post type thumb?
I call my thumbs like this:
cp_get_image($post->ID, 'ad-thumb', 1);
I would really appreciate the help... I just can't get it to work :-(
Thanks,
C.
Hi, did you have a look at the readme.txt? It has examples for custom loops. cp_get_image() doesn't seem to be a wp function btw.
Hello,
Yes I looked at your read me file but I can't get your example to work with custom post type images, which is the whole point of using your plugin versus YARP.
cp_get_image() is a custom function that works when I need to display thumbnails in the sidebar or anywhere in the posts so I know that it can be called. I'm just really fuzzy about this whole custom post system so I would appreciate the guidance.
I'm sure many more people will be interested in knowing how to do this over time ;-)
Thanks for understanding,
C.
Custom post types aren't different from normal posts in regard to thumbnails.
The "How to build a custom loop of related posts" in the readme.txt features post thumbnails. Maybe I can help more if you ask a more specific question.
Oh, and you should not hack the plugin files btw, everything can be done in a custom loop. If you find any limitation let me know and I'll see what I can do.
Hi Nicolas, I manage a site with about 3000 posts: http://personensuchpool.de but no related posts will be shown. All your requirements are fulfilled: php5, mysql5. I deactivated other plugins but nothing and there are a lot of related ones. What do I wrong.
Thank you
Dietrich
Sorry, dämlichen Fehler gemacht, 2 Plugins verwechselt. Nun muss ich nur noch anpassen. Klasse Plugin, danke
Dietrich
:-D Kein Problem! Bitteschön!
Cool plugin! I set up a custom loop with thumbnails. Is there a way to show related items with thumbnails before those that don't have one? Or to show only related items that have thumbnails?
Yes sure, see http://codex.wordpress.org/Function_Reference/has_post_thumbnail for the latter. For the former you can store the posts with thumbnail in an external var or loop through your posts twice, see http://codex.wordpress.org/The_Loop
Thanks. For some reason I couldn't get has_post_thumbnail to work wherever I tried to integrate it (I must've not found the proper place to use it in my custom loop.) But I was able to get it to work by adding this to the array of argument:
''meta_key' => '_thumbnail_id','
From: http://wordpress.org/support/topic/display-the-post-only-if-thumbnail-is-set-up
Your other option sounds cool, but is way over my head. Just wanted to post this in case it helps others.
http://wordpress.org/support/topic/display-the-post-only-if-thumbnail-is-set-up#post-1769764
One last question, if you’d be so kind.
If, for instance, only 2 related posts are displayed with thumbnails, can a custom loop be set up to automatically display 3 random posts with thumbnails to fill out all 5 areas?
This may be a hard one.
This plugin doesn't show random posts. But you can probably just store the post IDs of the first loop and start a second loop that excludes those posts. See http://codex.wordpress.org/Function_Reference/query_posts for random order IIRC
I got it to work! Thought I'd share. I set up two loops, and somehow figured out how to set up a counter, so that the second loop returns only enough thumbnails to fill in 5 total thumbnails in case fewer than 5 related items exist. This way there are always 5 thumbnails and it looks great. It's only missing one thing, an argument to exclude the current post itself on which these are displayed from being returned as a thumbnail. But I tried everything and haven't found an argument that works. But it's still pretty darn well. Works for me. Thought it might help others and wanted to share.
<strong>Edit</strong> Sorry, I had to remove your code. WordPress is really lousy when it comes to code in comments. Can you pastebin your code? I'll be able to have a look then.
http://pastebin.com/kMc78FEj
Give this link a try. My code looks a little messy, so if you see a way to improve upon it, like excluding the current post, I'd love to hear.
BTW, when I turn on WordPress' debug in wp-config, my code gives this notice:
Notice: Undefined variable: do_not_duplicate
The code obviously works. So it's not a big deal. But should I just set the variable equal to zero right before using it, so it's defined?
Well, notices aren't so bad. Just define the variable before trying to access it. Like, $foo = array() etc.
Hi, I have using your the plguin. but it is show some wrong in admin panel. I am using mysql 5.1.54 and your plguin v0.4.3.3.
"There is no fulltext index for wp_posts.post_content
There is no fulltext index for wp_posts.post_title"
Your database probably doesn't use the MyISAM engine, which is the default for mysql. You should probably talk to your admin/hosting provider. This plugin will only support databases that support fulltext indexes.
See the comments by Leonardo for how to test which MySQL engine you're using.
I just see that InnoDB has been made the default with MySQL 5.5.
You could <a href="http://dev.mysql.com/tech-resources/articles/storage-engine/part_1.html" rel="nofollow">change the engine for wp_posts</a>.
I guess I could easily attempt to change the storage engine of the relevant table after asking for user permission. I'll be include such a feature in the next release.
There is no fulltext index for wp_posts.post_content
There is no fulltext index for wp_posts.post_title
I am using WP 3.2 RC3, and since 3.2 minimum requirements for Wordpress is MySql 5.0. I guess that's the problem, engine is InnoDB on all tables... be sure to fix it before 3.2 goes official :)
I went to PHPMyAdmin and changed the engine of 'posts' table to MyISAM, and your plugin works perfectly now :)
I think should use InnoDB,so mysql offical choose. we have to use InnoDB. I have plan update to mysql v5.5. I have try mysql5.1 to5.5. but it is has some issue.
I'll have to look into the reasons why MySQL decided to use InnoDB by default. If you can't switch the content table to MyISAM this plugin isn't for you, at least not at the moment. This plugin uses fulltext indexes for the search, which InnoDB doesn't have. I'll keep an eye on the future development.
By the way, MySQL changing the default storage engine will only affect new databases, not existing ones.
I remember mysql offical said will give up MyISAM. This is a long time ago what they have decided. So I am use InnoDB. though I like the MyISAM easy backup.If I use MyISAM,then will not easy for mysql upgrade.
now your plguin work in my WP blog. but I do not know what effect that error.
thanks Nicolas for this plugin...
Currently I am using YARPP but I am planning to replace that with the plugin developed by you...i have one question though (a noob here)..I want to use a thumbnails in the related posts..can you guide/suggest me how to do that.
Thanks
Do you know how to build a normal loop with post thumbnails? Do you actually use the post thumbnail feature? If so, there is an example of a loop in the readme.txt iirc.
Hello Nicolas,
I'm having this problem with the plugin:
I'm trying to use the plugin to a post type called "Events", but it is showing only the posts of "events" are marked with the same taxonomy. I want him to show all posts "Events", regardless of their taxonomies. There's how to do this?
Thanks for the plugin.
Hug.
Did you check the analyze function yet? Maybe the contents of your events just aren't related enough? Also, the plugin only checks relatedness in the post_content field, not in any custom fields.
hi
1st of I have to thank u for the great plugin ! it's really useful ! I got question :
How can I insert it in my template and remove the automatic related links just after the post ? I wanna place it after the post block
Thanx
Check the options page, or the readme.txt.
Hi nicolas,
your plugin is nice, but after I installed for about two weeks, I can't display my preview post, even single post I.
the error massage:
Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in .../public_html/wp-content/plugins/better-related/inc/scorer.php on line 382
now I'm deactivating the plugin and waiting your advice.
thanks
Hi,
you'll have a hard time trying to get any plugins to work with 32MB. You should probably look into getting a better hosting package with more RAM.
You could try to reduce the query limit and to activate incremental scoring.
Exactly the same experience. PHP allowed size is same as above. Every othee plugin works like a charm. I tried to lower query limits. It allowed me to lower them to 100 (Query limit) and 200 (Total Query limit) , I also activated incremental scoring. But doesn't work. Failed to show the page at all. It started when the number of posts raised. There are currently about 8000 posts in the blog. Any suggestion ?
Well, I don't think this is something I can do much about. 32MB is really not enough to run many plugins. You could try the YARP plugin, maybe that works.
Hi, there is a problem with the admin backend: it doesn't seem to escape the values it tries to insert into the form.
Try using
<strong style="color:red">Related Posts</strong>
in the title field. The value is saved correctly but when the form shows up again its broken.
Thanks for reporting this, I'll look into it ASAP.
Hi Nicolas,
I just installed your plugin and was very impressed since it actually recognized the custom posts and ads through the admin settings panel in the classified theme that I'm using (ClassiPress from AppThemes), although when I test drive it on the front end, I always end up with "No related content found" despite checking all the custom fields in the settings and this theme explicitly uses the custom post types yet no results :(
post page ad_listing
category post_tag post_format ad_cat ad_tag
I'm on a dedicated server so no DB issues, using WP 3.1 latest update and using ClassiPress theme. Admin preview: http://www. appthemes.com/demo/?theme=classipress-admin
Did you try the analyze tag yet? It's usage is described in the readme.txt.
No I haven't and I just realized that the plugin actually worked but only under the main Blog posts and not the custom posts and custom categories, I'll try the Analyze tag attempt and update you with the outcome.
Thanks Nicolas.
Hi Nicolas,
Do you know what this warning might mean in regards to the code listed below it?
Warning: array_keys() [function.array-keys]: The first argument should be an array
$posts = array_slice( array_keys( $scores ), 0, 5 ); // keep only the the five best results
Is this happening because no related items are found?
Hm, I'm not sure right now, but I'll look into this.
Thank a lot for your superbe plugin - very helpfull.
Unfortunately I am faceing the same problem like Thompson getting the following error messages:
Warning: array_keys() [function.array-keys.php]: The first argument should be an array
Warning: array_slice() expects parameter 1 to be array, null given
I copied your code example as it is from the readme.txt file and added a custom post type.
I would highly appreciate your help in this matter.
Thanks, Benjamin
An example of the page you'll find on http://karpet.ch/redesign/teppich/almaty/
I adjusted the code slightly, but even with the code from your readme.txt file, i got the same problem.
Below the the «Diese Shyrdaks werden Ihnen auch gefallen» 6 related items should be listed within the slider.
The weird thing is, that sometimes it works but most of the time i get the above mentionned error message.
Thank you so much for your kind help. A donation for your superbe plugin will be for sure..! ;o)
Regards from Switzerland,
Benjamin
Hi, is it possible to use it with special post (post type). I'm using post type to differ products from regular blog both in front and back end.
Yes, please check the readme.
Hi Nicolas, I've already read the readme.txt file and all comments above, but I've a doubt about using taxonomy.
Say I have 2 different posts types, A and B, and a custom hierarchical taxonomy named "type", defined on both. If I use a configuration like this:
http://w3b.pastebin.com/v0erkGFN
should I get a selection of related posts from A to B (and viceversa), only if they SHARE THE SAME TERMS under "type" taxonomy, ?
In other words, for a post in A (or B), can I get a list of related posts, but only selected among B (or A) posts classified with the same terms under the same taxonomy?
Thanks in advance, Daniele.
Hi Daniele,
hm, I don't think so. It's been a while I've worked on this code but I don't think you can query only one post type.
What you could do is to filter by post type in the loop that displays the results though (I guess).
For the next major release I wanted to rewrite the taxonomy scoring anyway, so I'll look into this. Thanks for the idea.
I can't activate che plugin. I'm using the WP 3.1 and the plugin Version 0.4.3.3. I also have Custom Post Type UI, Custom Field Template, Header and Footer and Tweet Import activate.
#######################
Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /nfs/c01/h16/mnt/6224/domains/sodastudio.it/html/wp-content/plugins/better-related/better-related.php on line 44
I think you're using PHP4? The plugins needs PHP5.
You are right, I have php4.
Thank you.
hi nicolas - huge thanks for making a plugin that works with custom post types - quick question:
my client has 3 distinct areas on the site - 3 blogs if you like - I filter these using categories - trouble is i use the category 'featured' across all 3 areas so it is relating blog posts just because they share 'featured' category
is there any way I can say 'ignore the 'featured' category' when scoring?
many thanks again
Hi Dean, sure, it's documented in the readme.txt. There are various scoring options you can disable/enable.
You can do this for just one specific category? by category ID?
I thought you could only add/reduce weighting for all categories?
thanks for your replies
ideally I'd like it to ignore for example Category ID6 for scoring but not penalise any post if it has that category.
my test site is here if you want to see [edit: 404]
anything that is 'Featured' category is what gets sent to the slideshow - which build a 'false' relationship
"There is no fulltext index for wp_posts.post_content
There is no fulltext index for wp_posts.post_title"
How I can solve this error?
Greetings Nicolas!
This is a great plugin. I have read this thread carefully and verified, that I am running PHP5 with MySQL 5.0.32. All tables are MyISAM. The plugin is creating FULLTEXT indexes called post_content_index and post_title_index for the post_content and post_title fields. I have even dropped and created the indexes by hand and used the code you suggested above. I received no errors in that process. My host will not be updating our MySQL version (grid based) for several months so I am stuck with it for now.
Unfortunately, I still receive the below error. Do you have any other thoughts?
There is no fulltext index for wp_posts.post_content
There is no fulltext index for wp_posts.post_title
Thank you very much!
Mike
Hm, that's odd. If the indexes exist maybe my code to detect them is buggy. Did you try to output related posts on the frontend? I'm not sure if the plugin would try to display them even without indexes detected.
What you can try is to add a <code>return true;</code> on line 223 of better-related.php to bypass the index detection. Please do tell me if the plugin works then, as that would be a rather annoying bug :-|
Nicolas,
I was able to get this corrected. It was not a problem with you plugin but with my database. I asked my host to take a look at the MySQL server and they corrected or changed something. Thank you for your comments and a great plugin!
Mike
Glad to hear it works :-)
Your plugin is really perfect. It is no doubt the best among all the similar plugin.
I have encountered a problem that I am unable to resolve hoping you can kindly help on it.
My blog can set the post to be automatically outdated for a period of time and the updated post will not be shown publicly.
However the related post plugin can find the related OUTDATED post and show up the OUTDATED post title.
How can I exclude those OUTDATED post from the related post result? Or do not show post more that a period of time, say 30 days?
Many Thanks in advance.
Line 300, I change to:
WHERE ( post_status='publish')
from:
WHERE ( post_status='publish' OR post_status = 'private' )
And Line 463 I change to:
AND ({$prefix}posts.post_status = 'publish')
from:
AND ({$prefix}posts.post_status = 'publish' OR {$prefix}posts.post_status = 'private')
But it is still showing the private posts. What should I do?
MANY THANKS!
I do you clear the score cache ?
Indeed I still can see private posts...
My question is how to exclude the "Privately Published" post?
THANKS!
Thanks,
Kallan
I'm making heavy use of custom meta fields in my site - and importing data into them from a Filemaker database
When I look at my database tables every custom field seems to have a duplicate - so I end up with one populated by filmmaker and one empty
Can i just check whether your plugin needs there to be duplicates of custom fields to work? Would your plugin duplicare custom field data in the wordpress database?
any help greatly appreciated
But I cant get it to work with custom post types.
It is displaying related content just fine with related pages and posts, but it is not displaying any related content from my custom post type 'events'. I have read the readme 20 times and all forums/comments. Can you help?
When I try to activate the plugin, I'm back with "plugin is enabled"but it remains off the list and I found nowhere menu for the parameter, and front "Call to undefined function"
???
Thank you for your help.
Is it also possible to show your plugin as a widget?
You might have to save the post ID into a variable and use it with the <tt>the_related_get_scores()</tt> call, I'm not sure if global $post is still set after the loop.
I asked this above but was not sure I was clear on on my question"
Can you remove one specific category from influencing the score?
I have lots of posts that use the category 'Featured' to send them to a home page slideshow but they are not related. The plugin obviously thinks they are.
So - is there any way to tell the plugin to ignore JUST the 'Featured' category for scoring purposes?
Hope you can help
Dean
When I use the plugin to automatically embed the related posts, it works fine but I can't get the manual insert with a custom loop to work.
I need to call the plugin only on the single post pages for my 'work' custom post type, and want it to pull custom posts from the 'artists' custom taxonomy. It works find when I use the settings in the admin panel but with - as far as I can gather - the same settings manually coded in it's only calling regular posts that don't share the 'artists' taxonomy.
This is the code I'm using: http://pastebin.com/HAJw1c5M
You need the_related_get_scores( get_the_id(), $args ), and to pass the result of that as 'post__in' parameter to WP_Query.
I've read the readme.txt. But I do not find how to exclude certain category or tags of my post.
Example: i wanna hide related post from category "video".
Can i ? What code should i write on the single.php ?
Thanks. I'm sorry i can't speak english well.
Hehehe..
GOD BLESS YOU.
If there is, I could not find it, if not, I think it would be a great idea to add it.
Any way, here's your plugin in action: http://www.bielousov.com/2011/toronto-lollipop/
For example one post type is called 'Events' and another called 'Training' and then both post types have the same set of taxonomy. I'm looking for a way to cross reference posts.
With this plugin is it possible to get the taxonomy from the current post, but then display related posts from the other post type with that same taxonomy name?
Thanks
It's actually a bug, but a small and sometimes useful one so I haven't fixed it yet. I'll probably keep this as the default behavior in the future as well as some people might depend on it.
I was getting a PHP warning notice: Undefined variable: r in .../better-related/inc/frontend.php on line 169
when there were no related posts found.
FIX:
17 queries itself isn't a problem at all. It can be a problem if those 17 queries have to go through a post table with a million posts though. That's why there's a query limit and incremental scoring.
first of all: great plugin.
Is there a way to display an excerpt following the related links?
It would be great if it is possible to show the normal excerpt of the post (or a certain count of words of the content section)...
Best regards,
Oliver
Does this work with WP MultiSite Network.
Is it compatible across network?
Thank You!
I'm using the custom code from the readme text (first example), but I can't get it to display the related post titles. It keeps saying 'no posts found'.
Though in the $posts array all the post id's are ok (eg
works fine, but I would like to use the custom code to display some metabox fields from a custom post type.
Am I missing something? I'm not a coder, could you help me out a little bit?
Thanks!
Britt
Got one question though; is it possible to show only related posts from the same custom post type? I only want to use the post_tag for relevance, but if you haven't filled in any tags somehow they show up on other custom post type posts...
Thanks!
First, I would say thank you for making a great plugin. It solved a lot of my problems searching for related post plugin to display related videos of my site in which I realized it's using custom taxonomy. Other related post plugin doesn't work until I found yours.
I just wonder on how to add a thumbnails to the results. I can only find the title link. I read your readme.txt but I don't know where i should start. I see this line in readme.txt:
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'thumb' );
}
echo '<br>';
I don't know if this is the line I am looking for and if it is,I don't know where to insert it, what file should I edit. Hope you can help me with this little problem. You are a great talented person.
Thanks.
After I saved changes, it appeared as '~span style=' in text area and 'Related:" size="60" /~' outside the editing area. I don't really need to change it right now but for the future, where should I look for editing this?
When i have the plugin enabled to show up in default wp posts it works fine.
But when i use a cpt with a default content editor and custom fields its returning 'No related content found' in that post type or for any other post type. ive tried with both the admin options and the manual options in the readme. I get the same result when i run the_related_analyze() too. Id does however return results for the default wp posts when i use the 'custom loop of related posts' example in a ctp.
At a bit of lose and would be if you could offer some advise. Much Appreciated
The Plugin is very nice and used to work for me, but I recently changed my theme and since then the releated posts only show up in the single-post-view. Is there some solution?
Thanks for all :-)
Miri
I'm getting some errors at the top of my related posts all of a sudden:
Warning: array_keys() [function.array-keys]: The first argument should be an array in /path-to/single.php on line 69
Warning: array_slice() expects parameter 1 to be array, null given in /path-to/single.php on line 69
Warning: array_search() [function.array-search]: Wrong datatype for second argument in /path-to/single.php on line 79
etc.
But only on 1 certain post? In single.php line 69 looks like this:
Any ideas on what might be causing the problems?
The particular post on which the problem occurs has some <object> and <iframe> tags in it.
Thanks for your help!
I made a post on the wordpress forums for more detailed information:
http://wordpress.org/support/topic/plugin-better-related-posts-embedcode-post-causing-warning-array_keys
It's definetely plugin related because when I disable the plugin, or remove the php code, the warnings dissapear too.
Any ideas?
Because
returns nothing and
returns 'NULL'.
Weird, it only happens when the post content has some embed codes...
Thanks
when i am post my hand i am see related post like it
http://fonec.info/?p=4055
post posts which auto post by plugin
FeedWordPress
simple and flexible Atom/RSS syndication for WordPress
related post not see like in links
http://fonec.info/?p=4035
http://fonec.info/?p=3590
hope you understanding me
and i am wait your help
www.fonec.info
link post in link
http://fonec.info/?p=6706
but when post from site by my self get reated posts
like that post
http://fonec.info/?p=6647
hope understanding me
One question. I use the tag 'the_related_for_string' and set the limit to 9 post but the result is only 5 post. Any Ideas how to set the limit for this tag ?
Thank you so much.
What am I missing? and how can I clear the cache? is this something i must manually do in the db table via phpMyAdmin? If so, I'm a bit clueless when it comes to editing DB's.
Thanks, and I love your plugin. When are we going to see some updates from all the great ideas posted above?
I shall put the code on github so that everybody can contribute patches. I'll try to do that in the new year.
Thanks a lot.
This plugin is really awesome , thanks for your effort .
I Have a small question , is there any code I can put in a certain post I don't want Related Posts to appear ?? Plus excluding this post from appearing on the related posts menu on other posts .
Waiting for your reply :) .
Thanks in Advance .
Any idea why it's showing a blank <li> at the bottom of this page in the related articles section:
http://www.partybuilders.com/ad-category/party-planners/
I think it has something to do with the code from here, because I changed it from <ul> to <li> to see the dots in front. Any ideas?
http://dev.opera.com/articles/view/16-html-lists/
You should also validate your HTML from time to time, see
http://validator.w3.org/check?uri-charset=%28detect+automatically%29&uri-doctype=%28detect+automatically%29&ss=true&uri=http%3A%2F%2Fwww.partybuilders.com%2Fad-category%2Fparty-planners%2F
I switched it back to <ul>, but it just lists the content without putting the bullet. Any idea why it is doing that?
http://www.partybuilders.com/ad-category/party-planners/
Thanks,
John
Here's my custom loop code: http://pastebin.com/2kYYN1jx
Any help or insights into why this is happening would be much appreciated.
http://www.nicolaskuttler.com/post/wordpress-loop-inside-a-loop/
Try using wp_reset_postdata() after your custom loop.
Great plugin. How do I change its position? In my blog posts (see e.g. http://bit.ly/INkdQj) the related posts appear at the end of the post text, but I would like it to appear after the bookmarks and the text in the blue dotted border.
I'd also like to display the post thumbnails, likein the blog homepage.
Thank you!
Great plugin. Is there any chance to add a post meta cleanup function as you mentioned in this forum threed? goo.gl/ub2uU
It would be a really usefull feature.
Thank you!
I am trying to analyze why this is still happening.
Have I missed the part in the docs where you explain that stuff?
But I need to remove base urls on the links, how can I do that ?
ps. for example href=http://www.example.com/bla-bla-bla/ to href=/bla-bla-bla/
"Warning: Missing argument 2 for wpdb::prepare(), called in /home/sitename/public_html/wp-content/plugins/better-related/inc/scorer.php on line 329 and defined in /home/sitename/public_html/wp-includes/wp-db.php on line 990"
Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/better-related/inc/scorer.php on line 474 and defined in /wp-includes/wp-db.php on line 990
This can be fixed as outlined here:
http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/
Thank you.
for Wordpress 3.5 I receive the following error:
Warning: Missing argument 2 for wpdb::prepare() etc...
you're using? I'm going to start my own blog in the near future but
I'm having a difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I'm looking for
something completely unique. P.S Sorry for getting off-topic but I
had to ask!
My tables are all InnoDB by default. I don't feel good about changing that, although I don't know enough about MySQL to substantiate that feeling.
Any update on this issue?
Thanks for all your hard work.
Michael.