zxfactor Posted January 3, 2011 Share Posted January 3, 2011 Hi Everyone, Could anyone tell me what I'm doing wrong to have genereated the following error: Parse error: syntax error, unexpected '>' in C:\xampp\htdocs\wordpress\wp-content\themes\tutorial\single.php on line 22 Here is a copy of my code: <?php get_header(); ?> <div id="container"> <?php if(have_posts()) : ?><?php while(have_posts()): the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> <?php link_pages('<p> '<strong>Pages:</strong>‘, </p>’, ‘number’); ?> <p class="postmetadata"> <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?> </p> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php previous_post_link('«,%link') ?><?php next_post_link('%link »,') ?> ('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?> </div> <?php else : ?> <div class="post"> <h2><?php_e('Not Found'); ?></h2> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> Quote Link to comment Share on other sites More sharing options...
denno020 Posted January 3, 2011 Share Posted January 3, 2011 which is line 22? Denno Quote Link to comment Share on other sites More sharing options...
revraz Posted January 3, 2011 Share Posted January 3, 2011 You start and end PHP code way too much. This is sitting out by itself ('No Comments »', '1 Comment »', '% Comments »'); ?> Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 This is line 22 <?php link_pages('<p> '<strong>Pages:</strong>‘, </p>’, ‘number’); ?> Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 You start and end PHP code way too much. This is sitting out by itself ('No Comments »', '1 Comment »', '% Comments »'); ?> I removed the following code - ('No Comments »', '1 Comment »', '% Comments »'); ?> and left <?php edit_post_link('Edit', ' | ', ''); ?> and I still get the error for line 22 Quote Link to comment Share on other sites More sharing options...
denno020 Posted January 3, 2011 Share Posted January 3, 2011 I reckon you've got your quotes messed up.. Look at them carefully and make sure you're opening and closing them correctly. Denno Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 3, 2011 Share Posted January 3, 2011 You're using "smart quotes" instead of regular quotes. Change <?php link_pages('<p> '<strong>Pages:</strong>‘, </p>’, ‘number’); ?> to <?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?> (I think) Ken Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 You're using "smart quotes" instead of regular quotes. Change <?php link_pages('<p> '<strong>Pages:</strong>‘, </p>’, ‘number’); ?> to <?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?> (I think) Ken kenrbnsn - Thanks for the recommendation, after making the changes, I still get the same error message, referring to line 22? Quote Link to comment Share on other sites More sharing options...
denno020 Posted January 3, 2011 Share Posted January 3, 2011 Is that function supposed to receive 3 parameters like that? Denno Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 3, 2011 Share Posted January 3, 2011 Please post your current code. I took your code, fixed the quote problems & removed the excess line and there are no syntax errors. Ken Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 Thanks for responding... This is my index code (index.php) <?php get_header(); ?> <div id="container"> <?php if(have_posts()) : ?><?php while(have_posts()): the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> <p class="postmetadata"> <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?><br /> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?> </p> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php posts_nav_link(); ?> </div> <?php else : ?> <div class="post"> <h2><?php_e('Not Found'); ?></h2> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> </body> </html> and this is the page the code refers to in line 22 (single.php) <?php get_header(); ?> <div id="container"> <?php if(have_posts()) : ?><?php while(have_posts()): the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> <?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?> <p class="postmetadata"> <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?> </p> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php previous_post_link('«,%link') ?><?php next_post_link('%link »,') ?> </div> <?php else : ?> <div class="post"> <h2><?php_e('Not Found'); ?></h2> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 3, 2011 Share Posted January 3, 2011 You still have the weird quotes in this line: <?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?> You need to use plain single quotes <?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?> Ken Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 okay.. I just realized that correct page.php instead of single.phh..however even with the correction made to single.php, I still get the following error message: Parse error: syntax error, unexpected '/' in C:\xampp\htdocs\wordpress\wp-content\themes\tutorial\single.php on line 22 This happens when I click on the tile of post.. if that helps any... Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 3, 2011 Share Posted January 3, 2011 We can't help you if you don't post your code. Ken Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 Sorry.. here is the corrected code.. the index php <?php get_header(); ?> <div id="container"> <?php if(have_posts()) : ?><?php while(have_posts()): the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> <p class="postmetadata"> <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?><br /> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?> </p> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php posts_nav_link(); ?> </div> <?php else : ?> <div class="post"> <h2><?php_e('Not Found'); ?></h2> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> </body> </html> the single php.. that the error refers to <?php get_header(); ?> <div id="container"> <?php if(have_posts()) : ?><?php while(have_posts()): the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> <?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?> <p class="postmetadata"> <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?> </p> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php previous_post_link('«,%link') ?><?php next_post_link('%link »,') ?> <?php edit_post_link('Edit', ' | ', ''); ?> </div> <?php else : ?> <div class="post"> <h2><?php_e('Not Found'); ?></h2> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> the page php <?php get_header(); ?> <div id="container"> <?php if(have_posts()) : ?><?php while(have_posts()): the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> <?php linl_pages('<p><strong>Pages:</strong>','</p>','number'); ?> <?php edit_post_link('Edit','<p>','</p>'); ?> </div> <?php endwhile; ?> <?php else : ?> <div class="post"> <h2><?php_e('Not Found'); ?></h2> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 3, 2011 Share Posted January 3, 2011 You STILL have not changed the weird quotes in this line <?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?> to single quotes <?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?> PHP does not recognize the characters ‘ and ’ as quotes. What editor are you using to develop your code? Ken Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 I'm using notepad.. not sure why it continues to show up that way. It doesn't look that way when I make the corrections. I will copy and paste your example to see if that resolves the problem and advise. Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 Okay ... that is so strange.. not sure what was going on.. but once I copied and pasted your code .. as opposed to typing it myself... that seem to resolve the problem... Thanks you so much for taking the time to continue to look at my issue. I really do appreciated it. Do you have a suggestion for a better editor? Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted January 3, 2011 Share Posted January 3, 2011 nm Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 3, 2011 Share Posted January 3, 2011 Do you have a suggestion for a better editor? Take a look at this thread for editor suggestions. I've used Dreamweave (expensive), Eclipse (free), NetBeans (Free), and UltraEdit (not free, but not too expensive). You should get an editor that does syntax checking and highlighting of syntax. Ken Quote Link to comment Share on other sites More sharing options...
zxfactor Posted January 3, 2011 Author Share Posted January 3, 2011 Ken, Thank for your help. I will def take a look at that thread and the editors you suggested. I have access to Dreamweaver. I was trying to write the code and learn. However, having an editor to point out errors. would be helpful. Thanks again Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted January 3, 2011 Share Posted January 3, 2011 nm again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.