Title: Parse error: syntax error, unexpected $end
Last modified: August 21, 2016

---

# Parse error: syntax error, unexpected $end

 *  Resolved [windstyles](https://wordpress.org/support/users/windstyles/)
 * (@windstyles)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/)
 * Today I upgraded my site to 3.5.1. All was running well until I decided to add
   a post widget to the sidebar. It kept giving me parse errors when trying to click
   on any of the post links.
 * I have searched and tried everything – reinstalled the the wp-includes folder
   from a fresh download of WP 3.5.1, used an old backup copy of the functions.php
   file, renamed theme and plugin folder to see if it would “force” wordpress to
   use a different theme, etc. And nothing seems to work. I get this error:
 * Parse error: syntax error, unexpected $end in /home/content/f/l/o/flowrite1/html/
   flowrite/wp-content/themes/bluehorizon/functions.php on line 65
 * Here is my functions.php file:
 *     ```
       <?php
       if ( function_exists('register_sidebar') )
           register_sidebar(array(
               'before_widget' => '<li>',
           'after_widget' => '</li>',
        'before_title' => '<h4>',
               'after_title' => '</h4>',
           ));
   
       // WP-mapleleaf Pages Box
       	function widget_mapleleaf_pages() {
       ?>
   
       <h4><?php _e('Pages'); ?></h4>
          <ul>
       <li class="page_item"><a href="<?php bloginfo('url'); ?>">Home</a></li>
   
       <?php wp_list_pages('title_li='); ?>
   
        </ul>
   
       <?php
       }
       if ( function_exists('register_sidebar_widget') )
           register_sidebar_widget(__('Pages'), 'widget_mapleleaf_pages');
   
       // WP-mapleleaf Search Box
       	function widget_mapleleaf_search() {
       ?>
   
        <ul>
       <li>
          <label for="s"><h4><?php _e('Search Posts'); ?></h4></label>
          <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/index.php">
   
                   <input type="text" name="s" size="18" /><br>
   
                   <input type="submit" id="submit" name="Submit" value="Search" />
   
       	</form>
   
       </li>
       </ul>
   
       <?php
       }
       if ( function_exists('register_sidebar_widget') )
           register_sidebar_widget(__('Search'), 'widget_mapleleaf_search');
   
       // WP-mapleleaf Blogroll
       	function widget_mapleleaf_blogroll() {
       ?>
   
       <h4><?php _e('Blogroll'); ?></h4>
   
       <ul>
   
       <?php get_links(-1, '<li>', '</li>', '', FALSE, 'name', FALSE, FALSE, -1, FALSE); ?>
   
       </ul>
   
       <?php
       }
       if ( function_exists('register_sidebar_widget') )
           register_sidebar_widget(__('Blogroll'), 'widget_mapleleaf_blogroll');
   
       ?>
       ```
   
 * This file has been working great until today…
 * I would truly appreciate any help!!!
 * Thank you!!

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [windstyles](https://wordpress.org/support/users/windstyles/)
 * (@windstyles)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/#post-3830606)
 * I failed to mention… now my site is down, with these errors on the dashboard 
   and the website itself. So, I cannot get into dashboard to make changes. Am trying
   to do it all via cpanel file manager and FTP.
    Thanks again!
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/#post-3830624)
 * What version did you upgrade from? Is this the theme [http://www.wordpressthemesblog.com/blue-horizon.html](http://www.wordpressthemesblog.com/blue-horizon.html)–
   the reason I ask is that theme demo uses wp 2.3.1
 *  Thread Starter [windstyles](https://wordpress.org/support/users/windstyles/)
 * (@windstyles)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/#post-3830638)
 * Sorry, not 100% sure but think I was on 3.1.2. Again, all seemed to be working
   fine after the upgrade, with the exception of the posts/categories. But, I had
   not used them before, just decided today I wanted to.
 * Can I go back to an older version? Should I just try to restore from backup the
   entire site and see if that helps? Not even sure how I’d do this since I cannot
   get into the dashboard….
 * Or, is there something else I can try (edit the above code?) that may help restore
   the site, even if the categories/posts don’t work in sidebar?
 * Thank you!!!
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/#post-3830642)
 * It is difficult to go back even if you have a backup of the database before the
   upgrade.
 * Using either method you have available rename themes/blue-horizon to themes/blue-
   horizonx. That should load the default wp theme and get you back into the dashboard.
 *  Thread Starter [windstyles](https://wordpress.org/support/users/windstyles/)
 * (@windstyles)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/#post-3830647)
 * Thank you, but I did try that and it failed too.
    But, I overwrote the functions.
   php file with the file from the default theme and it got me back up and running!
   Of course, except for the posts/categories in the widget area.. they still give
   me errors.
 * I get this error:
    Parse error: syntax error, unexpected ‘<‘ in /home/content/
   f/l/o/flowrite1/html/flowrite/wp-content/themes/bluehorizon/index.php on line
   12
 *     ```
       <?php
       @include("Mobile_Detect.php");
       $detect = new Mobile_Detect();
       if ($detect->isMobile() && isset($_COOKIE['mobile']))
       {
       $detect = "false";
       }
       elseif ($detect->isMobile())
       {
       header("Location:http://m.flow-riteplumbing.com");
       }
       <?php 
   
       include_once('gravatar.php');
   
       get_header();
       ?>
   
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
       }
   
       <div class="post">
       	 <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
       	<div class="meta"><?php the_category(',') ?> — <?php the_time('l, F j, Y') ?>  <?php edit_post_link(__('Edit This')); ?></div>
   
       	<div class="storycontent">
       		<?php the_content(__('(Read on ...)')); ?>
       	</div>
   
       	<div class="feedback">
                   <?php wp_link_pages(); ?>
                   <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
       	</div>
   
       	<!--
       	<?php trackback_rdf(); ?>
       	-->
   
       </div>
   
       <?php comments_template(); ?>
   
       <?php endwhile; else: ?>
       <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
       <?php endif; ?>
   
       <?php posts_nav_link(' — ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
   
       <?php get_footer(); ?>
       ```
   
 * This was the original problem I was having, before I broke everything 🙂 Any 
   ideas?
 * Thank you!!
 *  Thread Starter [windstyles](https://wordpress.org/support/users/windstyles/)
 * (@windstyles)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/#post-3830650)
 * I think I’ve got it… with a small exception and I will open a new topic for that
   one 🙂
 * I needed to add the closing tag ?> on line 12.
 * This fixed my trouble with posts/categories.
    Thank you, kmessinger, for your
   help!! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Parse error: syntax error, unexpected $end’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [windstyles](https://wordpress.org/support/users/windstyles/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-19/#post-3830650)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
