Making a custom Wordpress theme Woocommerce compatible - while statement question


#1

Hello,

I’ve taken over supporting a website that has been built with a custom made theme. We want to integrate a shop (woocommerce). I’m editing the template php files to try to get woocommerce working. The documentation says you should look in page.php for the loop and replace it with <php woocommerce_content();?>
They state the loop will start with <?php if ( have_posts() ) : and end with <?php endif; ?>.

When I look in my page.php file, the loop is as follows:

while ( have_posts() ) : the_post(); ?>
<?php if ( has_post_thumbnail() ) { get_template_part( 'content/featured_image', 'page' ); }?>
<div id="body" class="page<?php if( $sidebar_children == true || $otherwidget == true ) {?>_sidebar<?php } if ( has_post_thumbnail() ) {?> with_featured_image<?php }?> page_<?php echo basename(get_permalink()); ?>">
	<div class="inner form_max the_top the_bottom">
		<?php get_template_part( 'content/page', 'content' ); ?>
		<?php if( $sidebar_children == true || $otherwidget == true ) {?><div id="sidebar"<?php if( $otherwidget == true || basename(get_permalink()) == "create-file" || basename(get_permalink()) == "create-page" ) {?> class="widget menu"<?php }?> role="complementary"><?php if ( basename(get_permalink()) == "create-file" || basename(get_permalink()) == "create-page" ) { wp_nav_menu( array( 'menu_id' => 'customerareamenu', 'container_class' => '', 'theme_location' => 'customerarea', 'walker' => new SH_Arrow_Walker_Nav_Menu() )); } else { wp_nav_menu( array( 'menu_id' => 'sidebar_menu', 'menu_class' => 'sidebar_meiuhnu', 'container_class' => '', 'theme_location' => 'primary', 'walker' => new SH_Arrow_Walker_Nav_Menu() )); }?></div><?php }?>
	</div>
</div>
<?php endwhile; get_footer(); ?>

I’ve changed to:

<?php woocommerce_content(); ?>
<?php get_footer(); ?>

I now get an error saying, " Parse error : syntax error, unexpected ‘<;’, expecting end of file in E:\XAMPP\htdocs\PureConcierge\wp-content\themes\pure\woocommerce.php on line 39

Can anyone help an absolute noobs at this please?

Many thanks,

Graeme


#2

I’ve managed to fix it. I didn’t alter the page template in the end. If anyone wants a possible solution, I kept the original template, deleted the woocommerce.php file. Copied the woocommerce plugin template folder to theme\content\woocommerce, and added some code into functions.php, (https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/)