• Hi, I made a page template which displays posts from a certain category but now my comments don’t work anymore, if i click on add comment it doesn’t do anything, here’s the code for my page:

    <?php get_header(); ?>
    
    <?php if (have_posts()) : the_post(); update_post_caches($posts); ?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    		<div class="info">
    			<span class="date"><?php the_modified_time(__('F jS, Y', 'inove')); ?></span>
    			<?php edit_post_link(__('Edit', 'inove'), '<span class="editpost">', '</span>'); ?>
    			<?php if ($comments || comments_open()) : ?>
    				<span class="addcomment"><a href="#respond"><?php _e('Leave a comment', 'inove'); ?></a></span>
    				<span class="comments"><a href="#comments"><?php _e('Go to comments', 'inove'); ?></a></span>
    			<?php endif; ?>
    			<div class="fixed"></div>
    		</div>
    		<div class="content">
    			<?php
    				query_posts('cat=1');
    				while (have_posts()) : the_post();
    				the_content();
    				endwhile;
    			?>
    			<div class="fixed"></div>
    		</div>
    	</div>
    
    	<?php include('templates/comments.php'); ?>
    
    <?php else : ?>
    	<div class="errorbox">
    		<?php _e('Sorry, no posts matched your criteria.', 'inove'); ?>
    	</div>
    <?php endif; ?>
    
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • Thread Starter ral_ani

    (@ral_ani)

    I realised something, it’s trying to access the comment of the page rather than the post, so go to comments is linked to “/?page_id=7#comments” whereas it should be going to “/?p=1#comments”, what should I do to fix this?

Viewing 1 replies (of 1 total)

The topic ‘Posts from a category – comments not working’ is closed to new replies.