Posting Within a Page – solved – sortof
-
I saw a couple posts in the past asking for a solution to posting within a page. I worked out the basic layout/template file which is pasted below, but I also have a couple questions that I’m hoping can find answers to. But first – the code:
<?php
/* Template Name: Groups */
?><?php get_header(); ?>
<div id="content">
<!-- page title -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><p><?php the_title(); ?></p></h2>
<div class="entry">
<?php the_content('<p>Read the rest of this page »</p>'); ?>
</div>
</div>
<?php endwhile; endif; ?><div id="groupcomment">
<!-- page comments -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><p>Group Disscussion</p></h2>
</div>
<?php comments_template(); ?><?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div>
<div id="grouppost">
<!-- posts w/o comments -->
<?php if (have_posts()) : ?><?php query_posts('ID=7'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><p>
<a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
<div class="sm"><?php the_time('F jS, Y') ?> by <?php the_author() ?> </div>
</p></h2><div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div></div>
<?php get_footer(); ?>What I’d like to accomplish is as follows:
I would like the post to be the same title as the page. So instead of query_posts(‘ID=7’) i’d like query_posts(‘pageNAME’). This would allow one template to execute instead of one for each page. What would be the proper way to grab the page name?Another question is the auto sizing of the text input box for the comments. It won’t autosize to the id=”groupcomment” div.
Lastly, this breaks Ajax commenting for some reason. Is there a way to have comment templates? I tried this, (TEMPLATE . ‘/newcomments.php’) but the comments aren’t showing up. Any ideas?
Thanks
ROb
The topic ‘Posting Within a Page – solved – sortof’ is closed to new replies.