where do I place this code in my templates

Discussion in 'WordPress' started by kevoh99, Jul 17, 2010.

  1. #1
    While trying to add the related posts plugin, I have to add the following code to my templates:
    <?php wp_related_posts(); ?>

    Where specifically should I add it?
     
    kevoh99, Jul 17, 2010 IP
  2. bablu

    bablu Peon

    Messages:
    277
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Go to Appreance-->Editor-->single.php and place the code where you want. If you don't understand my point, send me your admin user and password. I will insert code.
     
    bablu, Jul 17, 2010 IP
    kevoh99 likes this.
  3. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, I too would only use it for single posts. In single.php, insert the code between the post and comments sections, like this:
    
    <div id="nav-below" class="navigation">
    <div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title' ); ?></div>
    <div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>' ); ?></div>
    </div><!-- #nav-below -->
    
    <?php wp_related_posts(); ?>
    
    <?php comments_template( '', true ); ?>
    
    Code (markup):
     
    Cash Nebula, Jul 17, 2010 IP
    kevoh99 likes this.
  4. kevoh99

    kevoh99 Peon

    Messages:
    175
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks Pals I have done it successfully. You Rock and have just gotten yourself an up to your reputation.
     
    kevoh99, Jul 17, 2010 IP