Custom Page Template – troubleshooting
-
Greetings,
I’m building a site and attempting to have my blog live in the sub folder blog, as in ‘website.com/blog’. I followed the instructions here. Once I apply the template of ‘blog’ to the new page called ‘blog’, everything it fails. Specifically, if I navigate to website.com/blog I get ‘index of blog’ and folders on the server. It’s as if there’s no index.php and nothing is there. If I try to navigate to a specific post, I get: ‘Parse error: syntax error, unexpected T_ENDWHILE in /home/donaldde/public_html/wp-content/themes/mytheme/single.php on line 50’
If I create the page ‘blog’ and leave it as the default template, it’s fine. On another note, I have changed the permalinks as the article recommends. My permalinks are:
/blog/%postname%
Any help is greatly appreciated!
Here’s the code for my custom page template:
<?php /* Template Name: Blog */ // Which page of the blog are we on? $paged = get_query_var('paged'); query_posts('cat=-0&paged='.$paged); // make posts print only the first part with a link to rest of the post. global $more; $more = 0; //load index to show blog load_template(TEMPLATEPATH . '/index.php'); ?> <?php get_header(); ?> <div id='contentcontainer'> <div id='content'> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="postdate"> <p class='postday'><?php the_time('d') ?> <p class="postmonth"><?php the_time('M') ?> <p class='postyear'><?php the_time('Y') ?> </div><!--POST DATE--> <div class="postcontent"> <h2><?php the_title(); ?></h2> <?php the_content('<p class="serif">Read the rest of this page » '); ?> <?php wp_link_pages(array('before' => '<strong>Pages:</strong> ', 'after' => ' ', 'next_or_number' => 'number')); ?> </div><!--POST CONTENT--> <br class="clear" /> </div><!--POST--> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php the_author() ?> <?php the_content('Read the rest of this entry »'); ?> <?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php endwhile; ?> <ul> <li><?php next_posts_link('« Older Entries') ?></li> <li><?php previous_posts_link('Newer Entries »') ?></li> </ul> <!--NO POSTS?--> <?php else : ?> <h2>Not Found</h2> Sorry, but you are looking for something that isn't here. <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> </div><!--CONTENT--> </div><!--CONTENT CONTAINER--> <?php get_footer(); ?>
- The topic ‘Custom Page Template – troubleshooting’ is closed to new replies.