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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Wordpress: Conflicting code for comments

  • 15-09-2010 8:40pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 3,057 ✭✭✭kjt


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


  • Registered Users, Registered Users 2 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