Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Wordpress: Conflicting code for comments

Options
  • 15-09-2010 9:40pm
    #1
    Registered Users Posts: 3,057 ✭✭✭


    Hey Guys,
    My head has been aching for a wee while and I've finally narrowed down the problem to a few lines. If you could help I'd REALLLLY appreciate it!

    I'm building a theme from scratch and everything is working bar showing the comments on the single.php page.

    I am calling
    <?php comments_template(); ?>

    but it seems to conflict with this bit of code that is in bold (which calls related posts just above the comments)
    <?php
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
    $tag_ids = array();
    foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

    $args=array(
    'tag__in' => $tag_ids,
    'post__not_in' => array($post->ID),
    'showposts'=>5, // Number of related posts that will be shown.
    'caller_get_posts'=>1
    );
    $my_query = new wp_query($args);
    if( $my_query->have_posts() ) {
    echo '<ul>';
    while ($my_query->have_posts()) {
    $my_query->the_post();
    ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php
    }
    echo '</ul>';

    }
    }
    ?>

    Anyone have any ideas?

    Thanks,
    Kyle


Comments

  • Closed Accounts Posts: 19 jimkennedy


    Hey Kyle,

    Did you try turning it off and back on again? <smiley face icon>

    Jim.


  • Registered Users Posts: 3,057 ✭✭✭kjt


    Just tried that Jim, didn't work :-/


  • Registered Users Posts: 3,057 ✭✭✭kjt


    Got it sorted. In case anybody has the same problem, just add this code below the custom loop.
    wp_reset_query();

    Kyle


Advertisement