Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [Solved] WordPress – related posts and comments messing up

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25395
    mpenguin
    Member

    Hi everyone,

    Back when I was still using WP 2.6 or 2.7, I hacked it up (used some PHP I found on the web instead of using a plugin) to display related posts. Anyway, it’s been a while and I forgot exactly what I had done (I don’t really know PHP), but I just realized that my WordPress posts are now displaying the comments from the last RELATED POST, not the post you are viewing. Here’s an example:

    http://expatintaiwan.net/2009/06/28/tra … to-taiwan/

    You’ll see there are 5 related posts. The last one is "English speakers have it easy." The comments are then displayed. Only the comments are for the related post, "English speakers have it easy," not for the Transformers post.

    I’ve got the section I think is responsible for the related posts and also the section for the comments, but I’m not sure. If I need to post more, please let me know. I’d appreciate some help in getting this figured out.

    Code:
    //for use in the loop, list 5 post titles related to first tag on current post
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
    echo ‘Related Posts:’;
    $first_tag = $tags[0]->term_id;
    $args=array(
    ‘tag__in’ => array($first_tag),
    ‘post__not_in’ => array($post->ID),
    ‘showposts’=>5,
    ‘caller_get_posts’=>1
    );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>

    ” rel=”bookmark” title=”Permanent Link to “>

    Code:

    If possible, I’d like to delete the PHP Related Posts hack and replace it with a reputable plugin. Then I’d like to get the comments sorted out.
    Thanks.

    #60423
    mpenguin
    Member

    I managed to fix it by messing with the PHP – removing the part I thought was responsible for the related posts. Guess I’ll try one of the plugins and see how those work.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.