Need help with related_posts plugin on wordpress blog

I am attempting to add a piece of code to my home.php file in order to have related posts appear on my website which is a wordpress blog.

I will give the instructions for this plugin and also will give the code for my home.php file and hopefully someone may know what it is I need to do. The code is supposed to go into the wordpress loop and no matter what I do it’s not working. I have a feeling I am not putting in all the correct code.

Instructions:

*** SETUP INSTRUCTIONS ***

  1. Upload the plugin file (related-posts.php) to your /wp-content/plugins/ directory and activate it.

  2. a) You will notice a “Related Posts Options” tab under your “Plugins” tab. If this is your first time installing this plugin please click the link for index table setup script at the bottom of the options page. You only need to do this once when you install the plugin for the first time. If automatic setup fails (can happen and may not even be my fault) read on …

    b) If automatic creation of a full text index fails. You will have to set it up manually. Don’t worry it’s not hard. Just open your database in phpMySQLadmin and run the following command (cut & paste):

ALTER TABLE wp_posts ADD FULLTEXT post_related (
post_name ,
post_content
)

Note: You may have to change wp_posts to something else if you are using a different prefix, which is common when you have multiple WP installs running of the same database.

  1. Put <?php related_posts(); ?> somewhere in your WP loop, et voila!

*** PARAMETERS ***

Starting with version 2.0 you can yust use the options page to customize the look and output. However you can use the following guide to edit the paremeters manually if you wish.

<?php related_posts($limit, $len, '$before_title', '$after_title', '$before_post', '$after_post', $show_pass_post, $show_excerpt); ?>

$limit - No. of related entries to display. (Defaut: 5)
$len - Desired excerpt length (no. of words). (Default: 10)
$before/after_title - Text to insert before/after the title section.
$before/after_post - Text to insert before/after the post exceprt section, if displayed.
$show_pass_post - Toggle show/hide password protected posts. (Default: False)
$show_excerpt - Toggle show/hide excerpts. (Default: False)

Example: <?php related_posts(5, 10, '

  • ', '
  • ', '', '', false, false); ?>

    Result: Will display an unordered list (output is ordered based on keyword matches) of a maximum of 5 “related” posts.

    End Instructions

    Begin my comments:

    I have done this successfully in the myphpadmin area:

    ALTER TABLE wp_posts ADD FULLTEXT post_related (
    post_name ,
    post_content
    )


    This part I am not sure about. I have a shared domain meaning one hosting account running several add on domains. Each domain does have a Wordpress install. I don’t know what they mean by: using a different prefix… … I think this means if I have multiple word press installs on one domain and that it does not refer to having multiple addon domains on a shared hosting account.

    Note: You may have to change wp_posts to something else if you are using a different prefix, which is common when you have multiple WP installs running of the same database.

    This section: not sure where in the “above” code to drop this code chunk. I tried several spots and nothing worked. Also, not really sure if I have it all set up correctly. The example above looks a bit different like this: <?php related_posts(5, 10, '

  • ', '
  • ', '', '', false, false); ?> I don’t understand what the false false, ", ", etc… means.

    What I would like is 5 -10 related posts with excerpt per post…

    The sentence below is the first example they give but I am supposed to put code between () to get results.

    1. Put <?php related_posts(); ?> somewhere in your WP loop, et voila!

    Hopefully, someone out here knows how to fix this… thanks!

    David

    We don’t provide support on third-party scripts, so you would have been better off seeking help on the WordPress forums or any forum/email address of the plugin you’re trying to install.

    From what I’ve seen, this is your walkthrough:

    3. Put <?php related_posts(); ?> somewhere in your WP loop, et voila!

    *** PARAMETERS ***

    Starting with version 2.0 you can yust use the options page to customize the look and output. However you can use the following guide to edit the paremeters manually if you wish.

    <?php related_posts($limit, $len, '$before_title', '$after_title', '$before_post', '$after_post', $show_pass_post, $show_excerpt); ?>

    $limit - No. of related entries to display. (Defaut: 5)
    $len - Desired excerpt length (no. of words). (Default: 10)
    $before/after_title - Text to insert before/after the title section.
    $before/after_post - Text to insert before/after the post exceprt section, if displayed.
    $show_pass_post - Toggle show/hide password protected posts. (Default: False)
    $show_excerpt - Toggle show/hide excerpts. (Default: False)

    Example: <?php related_posts(5, 10, '

  • ', '
  • ', '', '', false, false); ?>

    Result: Will display an unordered list (output is ordered based on keyword matches) of a maximum of 5 “related” posts.

    It pretty much explains what the parameters do. If you want to show 10 posts instead of 5, you should pass the first parameter with value 10.

    Sponsor our Newsletter | Privacy Policy | Terms of Service