Blog posts within a page template
-
Ok heres the problem.
I have made a new page template like so
<?php /* Template Name: Blog */ ?> <?php get_header(); ?> <?php query_posts('cat=17'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="post-main"> <h2 class="post-title"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?> <?php the_title(); ?>"><?php the_title(); ?></a> </h2> <div class="post-entry"> <?php if (is_search()) { ?> <?php the_content('more_link_text', strip_teaser, 'more_file'); ?> <?php } else { ?> <?php the_content(__('Read the rest of this entry »')); ?> <?php } ?> </div> <!-- <?php trackback_rdf(); ?> --> </div><!-- End of .post-main --> </div><!-- End of .post --> <?php endwhile; ?> <!-- Page Navigation --> <?php if (function_exists('wp_pagenavi')) : ?> <div class="pagenavi"> <?php wp_pagenavi(); ?> </div> <?php else : // Use WordPress default page navigation. ?> <div class="pages"> <span class="older"><?php next_posts_link('« Older Entries'); ?></span> <span class="newer"><?php previous_posts_link('Newer Entries »'); ?></span> </div> <?php endif; ?> <?php else : ?> <div class="post-main"> <h2 class="post-title"><?php _e('404 - Not Found'); ?></h2> <div class="post-entry"> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> </div> </div> <?php endif; ?> <?php get_sidebar(); ?> <?php get_footer(); ?>
Assigned that page template to a new page entitled blog and created a new category called blog (which has the id of 17)
Now when i post blog entries within the blog category they show through that page and act like a normal blog.
The only problem i have is getting the
<strong><!-- more --></strong>
tag to excerpt the blog posts. Currently it refuses to excerpt the post where i define and shows the entire blog post one after another.It doesn’t seem to parse whatever I do within that page although ironically if I set the posts page to blog in the wordpress options panel it does indeed then work as it should, so I know the template is right.
This would work ok but i wanted to create another page similar to this for news.
Anybody any ideas what I’m doing wrong and how i can get this template page to parse that
<strong><!-- more --></strong>
tag ?
- The topic ‘Blog posts within a page template’ is closed to new replies.