Insert posts on custom page template above comments (3 posts)

  1. nicoliver
    Posted 6 years ago #

    Hey all,

    I'm completely stuck right now..
    Basically what I have done is to create a custom page template.

    The idea is that I want to display posts from a specific category on this page (which I have managed to do). However, after this I would like to show the comments section for the page that is being viewed.
    This is the bit that isn't working.

    I think it could be something to do with the post category being defined at the start of the code.. Maybe it needs some form of stop or reset command to tell it to show the specific page data again and not posts?

    Any help would be amazing!

    Here's the code that I have working at the moment..

    Template Name: Custom Page
    <?php get_header() ?>
    <div id="content">
    		<?php if (have_posts()) : query_posts('showposts=100&cat=3'); ?>
    		<?php while (have_posts()) : the_post();  ?>
    		<div class="post">
    				<div class="postinfo">
    						<h2><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h2>
    				<div class="commentslink1-top"></div>
    				<div class="postcontent"><?php the_content() ?><!--?php the_excerpt() ?--></div>
    		<?php endwhile; else: ?>
    		<?php endif; ?>
    <?php get_sidebar() ?>
    <?php get_footer() ?>

    I've tried adding the whole
    <?php comments_template(); ?>
    but with no success..


  2. nicoliver
    Posted 6 years ago #

    I've just noticed that even with the standard page.php template, the comments section doesn't show up. Which means the template isn't using them on the 'page' pages I guess? (it's activated in admin though..)

    Any ideas?

  3. nicoliver
    Posted 6 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic