thanks for the reference but although relevant it didn’t seem to really give me an idea of how to proceed. I modified the php now to look like this and now the page shows a syntax error. Anyone have an idea as to what my novice mind did wrong?
<?php get_header(); ?>
<div id="single_cont">
<?php if ( in_category('curriculum vitae') ) {
include 'single-cat-custom.php';
} else {
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1 class="single_title"><?php the_title(); ?></h1>
<div class="datetime">
<?php the_time('m/j/y'); ?> at <?php the_time('G:i'); ?>
</div>
<div class="single_inside_content">
<?php the_content(); ?>
</div><!--//single_inside_content-->
<br /><br />
<?php comments_template(); ?>
<?php endwhile; else: ?>
<h3>Sorry, no posts matched your criteria.</h3>
<?php endif; ?>
</div><!--//single_left-->
<?php get_sidebar(); ?>
<div class="clear"></div>
</div><!--//single_cont-->
<?php get_footer(); ?>
You started a new PHP block, but never closed it, like so:
<?php if ( in_category('curriculum vitae') ) {
include 'single-cat-custom.php';
} else { ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Or run the two adjacent blocks together like so:
} else {
if (have_posts()) : while (have_posts()) :
In a similar vein, you opened a curly brace block after else
, but I don’t see where it was closed. You probably need to insert <?php } ?>
towards the bottom somewhere. Unless you did and I’m just not seeing it.
Thanks for getting back to me.
I tried your first solution however I got the same syntax error on line 26.
<?php get_header(); ?>
<div id="single_cont">
<?php if ( in_category('curriculum vitae') ) {
include 'single-cat-custom.php';
} else { ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1 class="single_title"><?php the_title(); ?></h1>
<div class="datetime">
<?php the_time('m/j/y'); ?> at <?php the_time('G:i'); ?>
</div>
<div class="single_inside_content">
<?php the_content(); ?>
</div><!--//single_inside_content-->
<br /><br />
<?php comments_template(); ?>
<?php endwhile; else: ?>
<h3>Sorry, no posts matched your criteria.</h3>
<?php endif; ?>
</div><!--//single_left-->
<?php get_sidebar(); ?>
<div class="clear"></div>
</div><!--//single_cont-->
<?php get_footer(); ?>
any thoughts?
You opened a curly brace block after else
, it is not closed. You need to insert <?php } ?>
towards the bottom somewhere.
I tried it but it didn’t seem to have any effect. I figured it out at least. For anyone else looking I uploaded two more php files. One with the modification to the single.php I needed and the other just a backup of the original coding.
I then opened up single.php and inserted:
<?php get_header(); ?>
<?php
if ( have_posts() ) { the_post(); rewind_posts(); }
if ( in_category(11) ) {
include(TEMPLATEPATH . '/single-cat-custom.php');
}
else {
include(TEMPLATEPATH . '/single-default.php');
}
?>
<?php get_footer(); ?>
Hope this helps anyone else looking to make specific changes to a post specific to a category.