• Resolved ivana78

    (@ivana78)


    Hello,

    I’m getting the error: Parse error: syntax error, unexpected ‘endwhile’ (T_ENDWHILE) in C:\wamp\www\DW_WP_Sites\wp-content\themes\First\content.php on line 8
    my code is the following:

    <?php get_header(); ?>
    	<?php if( have_posts() ):
    	while( have_posts() ): the_post(); ?>
    	<?php get_template_part('content'); ?>
    	<?php endwhile; endif; ?>
    <?php get_footer(); ?>

    Everything is properly closed, pls.advice

    Ivana

Viewing 8 replies - 1 through 8 (of 8 total)
  • stephencottontail

    (@stephencottontail)

    Is that the entire contents of content.php? You don’t have eight lines of code in your snippet.

    Thread Starter ivana78

    (@ivana78)

    This is the content of my index.php. Aside I do have content.php file with following content:

    <small>Posted on:  <?php the_date('d.m.Y'); ?> time: <?php the_time('H:i');?>h in category: <?php the_category(); ?></small>
    	<h3><?php the_title(); ?></h3>
    	<div class="thumbnail-img"><?php the_post_thumbnail(array(200,200)); ?>
    	<p><?php the_content(); ?></p>
    	<hr>

    regards, Ivana

    stephencottontail

    (@stephencottontail)

    Is that the entire contents of content.php? The message indicates that the error is on line 8 of content.php but I don’t see any “endwhile” in that file.

    Thread Starter ivana78

    (@ivana78)

    I added:
    ‘<?php endwhile; endif; ?>’
    to close the loop and if, but I still receive the same massage:
    Parse error: syntax error, unexpected ‘endwhile’ (T_ENDWHILE) in C:\wamp\www\DW_WP_Sites\wp-content\themes\First\content.php on line 8

    stephencottontail

    (@stephencottontail)

    Can you post the full contents of content.php? If it’s too long (over 20 lines or so), post it to Pastebin and post the link here instead.

    Thread Starter ivana78

    (@ivana78)

    Here it is the content of the content php:

    `<br>
    <small>Posted on: <?php the_date(‘d.m.Y’); ?> time: <?php the_time(‘H:i’);?>h in category: <?php the_category(); ?></small>
    <h3><?php the_title(); ?></h3>
    <div class=”thumbnail-img”><?php the_post_thumbnail(array(200,200)); ?>
    <p><?php the_content(); ?></p>
    <hr>
    <?php endwhile; endif; ?> `

    stephencottontail

    (@stephencottontail)

    You don’t need this line:

    <?php endwhile; endif; ?>

    in content.php at all; you’re closing the loops in index.php.

    Thread Starter ivana78

    (@ivana78)

    Thanks, it worked ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Parse error: syntax error, unexpected 'endwhile' (T_ENDWHILE)’ is closed to new replies.