Hello,

I'm the volunteer webmaster for my church and tried to integrate a WordPress blog into my CSS-HTML site. It was going well following the tutorial at http://www.burnseo.com/blog/2009/10/integrate-wordpress-into-existing-website-tutorial/ until I edited the index.php file with the tutorial's code shown below. Then I got syntax errors in the browser, starting with this line: <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>. My attempts to edit the code failed. Could anyone spare the time and expertise to clean up this code for me?

Thank you,
Laurie

<?php if (have_posts()) : ?> 

<?php while (have_posts()) : the_post(); ?>

<div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>
<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h2>
<small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

<div>
<?php the_content(‘Read the rest of this entry &raquo;’); ?>
</div>

<p><?php the_tags(‘Tags: ‘, ‘, ‘, ‘<br />’); ?> Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments &#187;’, ’1 Comment &#187;’, ‘% Comments &#187;’); ?></p>
</div>

<?php endwhile; ?>

<div>
<div><?php next_posts_link(‘&laquo; Older Entries’) ?></div>
<div><?php previous_posts_link(‘Newer Entries &raquo;’) ?></div>
</div>

<?php else : ?>

<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn’t here.</p>
<?php get_search_form(); ?>

<?php endif; ?>

Recommended Answers

All 7 Replies

At first glance it looks like all your single and double quotes are messed up. Did you use Word to edit the php file ? Use a plain text editor to change them back into ' and "

At first glance it looks like all your single and double quotes are messed up. Did you use Word to edit the php file ? Use a plain text editor to change them back into ' and "

Thank you for your reply. I copied the code from the online tutorial and pasted it into Notepad++. Other users reported syntax errors as well, so I think it's the way the author posted it online.

I am not confident that I know enough to correct the syntax. Could you help? The suggested code is at http://www.burnseo.com/blog/2009/10/integrate-wordpress-into-existing-website-tutorial/

Laurie;
Hope I got this right... I just did search and replace using Textpad. Didn't check it properly. Please post a reply if it's still messed up.

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!" by <?php the_author() ?> "></small>

<div>
<?php the_content('Read the rest of this entry &raquo;'); ?>
</div>

<p><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', ", ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>

<div>
<div><?php next_posts_link('&laquo; Older Entries') ?></div>
<div><?php previous_posts_link('Newer Entries &raquo;') ?></div>
</div>

<?php else : ?>

<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>

Oh thank you! Looks like the part you edited is perfect. Now I get this error:

"Parse error: syntax error, unexpected $end in /home/hicko6/public_html/blog/wordpress/wp-content/themes/twentyten/index.php on line 84"

Line 84 is the last line of code:

<?php get_footer(); ?>

What do you think could be wrong there?

Member Avatar for diafol

You may have a missing close brace somewhere (}). Check all the obvious stuff: braces, quotes, semicolons.

Thank you for your time and expertise. I do appreciate it! The code works much better now, but I see that I was too ambitious for one who is not a programmer. Some vital functionality is missing and I think I will resort to using an existing WordPress template and modify it with the banner from my site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.