I'm trying to use the related posts 2.04 plugin found here But when I try to do the step that says, "If this is your first time running this plugin you will have to run this script." If I try and run the script it just says you are not a level 8 user. I don't know what that means, so I just tried to look in the readme for the next step. It says if it fails to open the database in phpMySQLadmin. So I opened up phpMyAdmin, selected my database and pressed the sql tab. I input the text like the readme says: ALTER TABLE wp_posts ADD FULLTEXT post_related ( post_name , post_content ) And pressed go and it says internet explorer can not display this page. So I tried it again, this time unchecking the box that says "Show this query here again." Then it gave me this error: SQL query: ALTER TABLE wp_posts ADD FULLTEXT post_related ( post_name , post_content ) MySQL said: #1061 - Duplicate key name 'post_related' I've tried running it a few times though, so did it perhaps work and now it's not letting me do it multiple times or something? If it is working, what am I supposed to do with the third step: 3. Put <?php related_posts(); ?> somewhere in your WP loop, et voila! I'm new to wordpress, so any help would be greatly appreciated. I want to get all my plugin's up and running before I start diving into blogging. Please help, thanks.
I've come across that problem as well. You are right in assuming that it has performed the necessary modifications. Try putting the third step in your template as suggested and see what happens. It worked for me. If you are still having problems with this plugin, an alternative to try is Weblog Tools Collection's version: http://weblogtoolscollection.com/archives/2004/06/08/contextual-related-posts-in-wordpress/ Good luck!
So where do I put this code though: <?php related_posts(); ?> Like what php file? Because I know it mentioned somewhere in the php loop, but does that just mean in any one of the files or what? Can someone let me know which file they used. Thanks in advance
In Wordpress admin, go to Presentation - Theme Editor. Click on "Single Post". Find: <?php comments_template(); // Get wp-comments.php template ?> Code (markup): Add directly under, this: <?php if(function_exists('related_posts')) { ?> <h2>You might also be interested in these</h2> <ul> <?php related_posts(); ?> </ul> Code (markup): Change "You might also be interested in these" to whatever you feel like.
Oh, before I even saw your post I went into my single.php file and index.php file and just put the <?php related_posts(); ?> right beneath this section of the code: <div class="post-content"> <?php the_content("Continue Reading »"); ?> Should I go back and change it to the way you described? Because I thought I put it in the right spot because now underneath my posts, but above my comments it says "No related posts" How many posts do I have to have / how simliar do they need to be before I can see if it works? Or did I put it in the wrong spot? Because I just made a quick post titled "test" with "test" as the body and then made another post titled "testers" with "testing it" as the body. Perhaps I need to make a lot larger posts to see a relation, but I thought it would just pick up on the word test. Is there any other way to verify it's working? Thanks for the help thus far. Edit: Oh, and if I just alter the single post template does that mean the related posts won't show up on the index of my site? Thanks.
You can put it anywhere you like actually, just as long you like it. As for verifying whether it works or not, you do need a few posts to see it working. Try doing this: create 2 posts, one with title "test #1 - first one", and "test #2 - second one". You should see them both being related. And yeah, the related posts plugin is meant to only work on single post pages so I don't know what would happen if you place it in the index file.
For this problem, i reassign admin rigths to the user (even if it is still admin). After reassigning permission, if you run the same script, you will see that it works now.
Hmmm, but if I reassign permissions and try and run that script when it's supposed to be "already working" I wonder if it will mess it up. And yah, I think you're right about the related posts plugin only supposed to be working on single post pages. I'm going to try it out now. I'll post back if it's still not working.
Ok, I tried re assigning the privledges and running the script thing again and it gave me this error message: Something went wrong. Please check the instructions on how to setup the full text index manually. So I don't think it's going to work that way. And the post test thing didn't work, they weren't related.
Is there anyway to for sure tell if I've set it up correctly? I see it says related posts: none after all my posts, but would it work to make one post then make an exact copy of it to see if it picked up the relation? I guess I'm still struggling and need some help.
Try doing titles that look like series. For examples, "Diary entry #1 - Monday" and "Diary entry #2 - Tuesday". You just need more content - so start adding the content and worry if it works or not. There are alternative plugins to try once you have enough content.
Ok, yah I suppose I don't need to have a related posts plugin active on Day 1 of my blog launch when I will likely only start with a few posts. I'll post back in this thread if it's been a while and it's still not giving related posts. Thanks
Update: The related posts appear to be working; however, it doesn't say "Related Posts:" And there aren't breaks after each post, they just run on the same line until the links make it to the end of the page dropping them down to the next line. Any ideas on how to fix this?
Under Plugins, click on "Related Posts Options". There you can add additional HTML tags preceding and following the post titles. Just follow the examples.
Ok, I found the section and didn't have any problem adding just a simple li tag, but I am not sure how to put "Related Posts:" Above just the first post. Because I put my code in like this: before Related Posts <li> Code (markup): after </li> Code (markup): And it shows up after each post. Is there a way to do this to make it show up only once via the related posts options in the admin cp? Or do I have to go into my php files and just put "Related Posts:" directly above the php code that inserts the related posts? Thanks in advance.
You are right - you DO NOT put "Related Posts" in the Options page. Look at post #4 above in this thread. That's how you should do it.
Ok, I think I got it to work, but the code you had above had an extra "}" symbol inside there so I had to take that out. After I did that though it worked. Thanks for the help, this is what I settled on: <?php if(function_exists('related_posts')) ?> <h3>Related Posts:</h3> <?php related_posts(); ?> Code (markup): I also decided to move the code up a little higher in the php file so it wasn't so low. I think that it's better to put them up more neat the meat of the content. I also plan to put this code in the main index template eventually... still not sure if I want to do the whole "read more..." thing for my posts because I feel like if people can read the entire post without clicking a link, they won't end up going into the post and in turn seeing my related posts.
Woops - sorry about the closing "}" that should be there. The code should look something like this: <?php if(function_exists('related_posts')) { ?> <h2>You might also be interested in these</h2> <ul> <?php related_posts(); ?> </ul> <br> <?php } ?> Code (markup): Closing off the "if" statement is usually safer. Yeah essentially how you implement it is up to yourself and what fits best for the purpose of your blog. But it's now working so the hardest part is done with.
Ok, I put the code in similiary to how you've done it above: <?php if(function_exists('related_posts')) { ?> <h3>Related Posts:</h3> <ul> <?php related_posts(); ?> </ul> <br /> <?php } ?> Code (markup): Is the above code supposed to not show "No related Posts" though? I thought if there weren't any related posts, that text simply wouldn't show. What do you think?