• Resolved ag4Official

    (@ag4official)


    I have encountered a silly problem on my website page called ‘News’, which is where the posts are displayed. But is said ‘Parse error: syntax error, unexpected T_STRING in home/[website]/public_html/wp-content/themes/summit-lite/loop.php on line 58’. I have identified lines 58 and 59. The theme is Summit Lite. Can someone help?

    Line 58:
    <span><i class="glyphicon glyphicon-user"></i> <a href="<?php echo get_author_posts_url(

    Line 58-59:
    <span><i class="glyphicon glyphicon-user"></i> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author_meta( 'display_name' ); ?></a></span>

    Whole loop-php file:

    <?php while ( have_posts() ) : the_post() ?>
    	<section class="content">
    		<article id="post-<?php the_ID(); ?>" <?php post_class('post-home'); ?>>
    			<h2 class="post-title">
    				<?php
    				$format = get_post_format();
    				$format_link = get_post_format_link($format); ?>
    				<?php
    				if ( has_post_format('link') ) {
    					the_title();
    				} elseif (is_sticky() ) { ?>
    					<a class="title-link" href="<?php the_permalink(); ?>" title="Permalink to <?php printf( the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a><span class="sticky-title">Featured</span>
    			 	<?php } else { ?>
    			 		<a class="title-link" href="<?php the_permalink(); ?>" title="Permalink to <?php printf( the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a>
    				<?php }
    				if ($format !== false) {
    					if ($format == "status") {
    						$format = 'comment';
    					} ?>
    					<a href="<?php echo $format_link; ?>" alt="The Post Format Archive"><span class="post-type glyphicon glyphicon-<?php echo $format; ?>"></span></a>
    				<?php } ?>
    			</h2>
    			<?php if ( has_post_format('link') ) { ?>
    				<div class="format-link">
    					<?php the_content(); ?>
    				</div>
    			<?php } else {
    				if (has_post_thumbnail() ) {
    					if (is_sticky() ) {
    					echo '<div class="sticky-featured-container"><a href="',
    						 the_permalink(),
    						 '">',
    						 get_the_post_thumbnail($post->ID, 'full', array('class' => 'sticky-featured-img')),
    						 '</a></div>';
    					} else {
    					echo '<a href="',
    						 the_permalink(),
    						 '">',
    						 get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'alignleft thumbnail')),
    						 '</a>';
    					}
    				}
    				if ($format == 'video') { ?>
    					<div class="video-container">
    						<?php the_content(); ?>
    					</div>
    				<?php }
    				else {
    					the_content('Read more &rarr;');
    				}
    			} ?>
    		</article>
    		<div class="meta-container">
    			<p class="meta">
    				<span><i class="glyphicon glyphicon-user"></i> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author_meta( 'display_name' ); ?></a></span>
    
    /*
    class="published" title="<?php the_time('Y-m-d\TH:i:sO')the_time( get_option( 'date_format' ) );|class="comments-link" comments_popup_link( 'Comment', '1 Comment', '% Comments' )
    */
    
    				<span><i class="glyphicon glyphicon-link"></i> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"">Permalink</a></span>
    			</p>
    	   	</div>
    	</section>
    <?php endwhile; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’ve got PHP-style comments (/* ... */) surrounding the line that starts with class="published" title="...", but they aren’t contained within a PHP block. Deleting all those lines:

    /*
    class="published" title="<?php the_time('Y-m-d\TH:i:sO')the_time( get_option( 'date_format' ) );|class="comments-link" comments_popup_link( 'Comment', '1 Comment', '% Comments' )
    */

    should get you back up and running.

    Thread Starter ag4Official

    (@ag4official)

    I have deleted those lines and cleared the cache, then checked straight away and the page is still only showing the error.

    Now it is like this…

    <?php while ( have_posts() ) : the_post() ?>
    	<section class="content">
    		<article id="post-<?php the_ID(); ?>" <?php post_class('post-home'); ?>>
    			<h2 class="post-title">
    				<?php
    				$format = get_post_format();
    				$format_link = get_post_format_link($format); ?>
    				<?php
    				if ( has_post_format('link') ) {
    					the_title();
    				} elseif (is_sticky() ) { ?>
    					<a class="title-link" href="<?php the_permalink(); ?>" title="Permalink to <?php printf( the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a><span class="sticky-title">Featured</span>
    			 	<?php } else { ?>
    			 		<a class="title-link" href="<?php the_permalink(); ?>" title="Permalink to <?php printf( the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a>
    				<?php }
    				if ($format !== false) {
    					if ($format == "status") {
    						$format = 'comment';
    					} ?>
    					<a href="<?php echo $format_link; ?>" alt="The Post Format Archive"><span class="post-type glyphicon glyphicon-<?php echo $format; ?>"></span></a>
    				<?php } ?>
    			</h2>
    			<?php if ( has_post_format('link') ) { ?>
    				<div class="format-link">
    					<?php the_content(); ?>
    				</div>
    			<?php } else {
    				if (has_post_thumbnail() ) {
    					if (is_sticky() ) {
    					echo '<div class="sticky-featured-container"><a href="',
    						 the_permalink(),
    						 '">',
    						 get_the_post_thumbnail($post->ID, 'full', array('class' => 'sticky-featured-img')),
    						 '</a></div>';
    					} else {
    					echo '<a href="',
    						 the_permalink(),
    						 '">',
    						 get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'alignleft thumbnail')),
    						 '</a>';
    					}
    				}
    				if ($format == 'video') { ?>
    					<div class="video-container">
    						<?php the_content(); ?>
    					</div>
    				<?php }
    				else {
    					the_content('Read more &rarr;');
    				}
    			} ?>
    		</article>
    		<div class="meta-container">
    			<p class="meta">
    				<span><i class="glyphicon glyphicon-user"></i> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author_meta( 'display_name' ); ?></a></span>
    
    				<span><i class="glyphicon glyphicon-link"></i> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"">Permalink</a></span>
    			</p>
    	   	</div>
    	</section>
    <?php endwhile; ?>
    Thread Starter ag4Official

    (@ag4official)

    In fact, the edit has now completed. It worked! Thank you so much.

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