Forums

[resolved] Comments link does not work. Help! (8 posts)

  1. arrakistor
    Member
    Posted 3 years ago #

    The theme I used seem to not have a comments link. I searched around and added one into index. It wouldn't appear. I checked the post to make sure comments are allowed, and they are. I checked to make sure I have a comments.php file, and I do.

    I did some more searching and found out how to add them to a single post:

    <a href="<?php the_permalink(); ?>#comments"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></a>

    Well now the link shows up, but when I click on it, it does absolutely nothing whatsoever.

    Help?

  2. arrakistor
    Member
    Posted 3 years ago #

    Also, there is no The_Loop in this index, not applicable. I also stuck this into my index,

    <?php comments_popup_link('No comments yet', '1 comment so far',
    '% comments so far (is that a lot?)', 'comments-link', 'Comments are
    off for this post'); ?>

    without any success. It doesn't show up at all.

  3. arrakistor
    Member
    Posted 3 years ago #

    bump

  4. arrakistor
    Member
    Posted 3 years ago #

    TTT! Still no help?

  5. MichaelH
    Volunteer
    Posted 3 years ago #

    As an example, in the WordPress Default theme, in wp-content/themes/default/index.php, the reference to the Template Tag, comments_popup_link is what causes readers to be offered a link to comment. But that template tag must be in The Loop so you may want to create a loop, even if showing only one post.

    Resources:
    Stepping Into Templates
    Stepping Into Template Tags
    Template Hierarchy

  6. arrakistor
    Member
    Posted 3 years ago #

    <?php $recent = new WP_Query("cat=30&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
    			<span style="font-size:18px;"><b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b></span><br /><br />
    
    			<div class="date">
    				<p><b><?php the_time('g:i A'); ?></b> on <?php the_time('D M j Y'); ?></p>
    			</div>
    			<br />
    
    			<?php the_content(__('Read This Article &raquo;'));?>
    			<br clear="all"/>
    <?php comments_popup_link('No comments yet', '1 comment so far',
    '% comments so far (is that a lot?)', 'comments-link', 'Comments are
    off for this post'); ?>
    			<div class="hppostmeta">
    
    			</div>
    
    			<?php endwhile; ?>

    Again, it doesn't show anything. It's as if the code is totally ignored while in the post enumeration loop.

  7. arrakistor
    Member
    Posted 3 years ago #

    UPDATE: I added the code into the loop and what it does show is No Comments, through home.php.

    When you click on the "No Comments Yet" link, which is linked to #respond, it takes you to the full article as if you had clicked "read more".

    OK fine, so then we would have to actually read the full article (via index.php) to make a comment.

    Then in index, I added the

    <a href="<?php the_permalink(); ?>#comments"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></a>

    for enumarating comments in a single post.

    That creates the %permalink%/#comments.

    Guess what. %permalink%/#comments does NOTHING. Why is there still no comments section show? Where is the comments section supposed to be?

  8. arrakistor
    Member
    Posted 3 years ago #

    SUCCESS.

    For some reason, my theme was missing

    <div class="comments">
    
    			<h4>Comments</h4>
    			<?php comments_template(); // Get wp-comments.php template ?>
    
    	</div>

    in the index.php

Topic Closed

This topic has been closed to new replies.

About this Topic