You need to have the semicolons after the “)”. Must have it in both cases. Also, make sure there is a space between the semicolon and the closing question mark.
Question:
Why do you have this code on a single post? There is no previous or next. You only need a previous or next link for a collection of posts, not a single one.
The idea of having the post links is so that you can go from one single post to another single post.
However, as I mentioned in my original post, when I add semicolons after each closing parenthesis and still get this error. And there are spaces between the semicolons and the question marks. I tried adding the semicolons again, and the error still shows up.
I see. Okay let’s try this…
All php statements must end with the semicolon. So, make sure the semicolons end each of these 2 statements. Then look in the lines above these statements for another statement that is missing the semicolon.
It’s likely that if this mistake exist once in this file, it exists elsewhere in the file as well.
As a test, I added your code to my single.php page (without semicolon); it worked fine. But it was the last line of code on the page. When I moved this line of code above another php statement though, the code failed.
When I added the semicolon, everything worked again. It is just a quick test but it did prove the lack of the semicolons will cause problems.
I read through single.php and I found this line:
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
I changed the colons to semicolons and removed the spaces, but it still didn’t work.
This is the relevant coding in single.php; maybe I’m missing something.
<?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="container">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<div class="post">
<a href="<?php the_permalink(); ?>" title=”<?php the_title(); ?>”><?php the_title(); ?></a>
<div class="entry">
<?php the_content(); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
<p class="postmetadata">
Filed under: <?php the_category(); ?> by <?php the_author(); ?> <?php edit_post_link('Edit', ' | ', '); ?>
</p>
</div>
<div class=”comments-template”>
<?php comments_template(); ?>
</div>
</div>
<?php endwhile; ?>
<div class="navigation">
<?php previous_post_link('%link'); ?> <?php next_post_link('%link'); ?>
</div>
<?php else : ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php ('Not Found'); ?></h2>
</div>
<?php endif; ?>
</div>
Thanks for all of your help so far. 🙂
No, you don’t want to do that! This portion of code is using the alternate php syntax.
Let me take a look here … brb
This section of code is wrong. There should be a closing single quote.
<?php edit_post_link(‘Edit’, ‘ | ‘, ‘); ?>
Edit is wrapped in single quotes, followed by a comma …
Space Post Space is wrapped by single quotes, followed by a comma …
Then there is a single quote. There should be 2 single quotes and probably somethin between them.
I removed everything after Edit and its single closing quote and it’s now working.
I don’t know what the | was supposed to be for, as I got help with the single.php coding from a tutorial. Thank you for pointing that out for me, and thank you for all of your help! 🙂