Title: Parse error question
Last modified: August 19, 2016

---

# Parse error question

 *  [johnsoncenter](https://wordpress.org/support/users/johnsoncenter/)
 * (@johnsoncenter)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/parse-error-question/)
 * I am getting this error:
    Parse error: syntax error, unexpected $end in /home2/
   nptwozer/public_html/blog/wp-content/themes/blixed-10/functions.php on line 162.
 * Here is my url: [http://www.np2020.org](http://www.np2020.org)
 * My code on functions.php is:
 *     ```
       <?php
       if ( function_exists('register_sidebar') )
       {
       register_sidebar(array('before_widget' => '',
       		'after_widget' => '',
       		'before_title' => '<h2><em>',
       		'after_title' => '</em></h2>',
       		));
       }
   
       /**
        * Function BX_archive
        * ------------------------------------------------------
        * This function is based on WP's built-in get_archives()
        * It outputs the following:
        *
        * <h3><a href="link">Month Year</a></h3>
        * <ul class="postspermonth">
        *     <li><a href="link">Post title</a> (Comment count)</li>
        *     [..]
        * </ul>
        */
   
       function BX_archive()
       {
       	global $month, $wpdb;
       	$now        = current_time('mysql');
       	$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM " . $wpdb->posts . " WHERE post_date <'" . $now . "' AND post_status='publish' AND post_type='post' AND post_password='' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC");
   
       	if ($arcresults) {
       		foreach ($arcresults as $arcresult) {
       			$url  = get_month_link($arcresult->year, $arcresult->month);
           		$text = sprintf('%s %d', $month[zeroise($arcresult->month,2)], $arcresult->year);
           		echo get_archives_link($url, $text, '','<h3>','</h3>');
   
       			$thismonth   = zeroise($arcresult->month,2);
       			$thisyear = $arcresult->year;
   
               	$arcresults2 = $wpdb->get_results("SELECT ID, post_date, post_title, comment_status FROM " . $wpdb->posts . " WHERE post_date LIKE '$thisyear-$thismonth-%' AND post_status='publish' AND post_type='post' AND post_password='' ORDER BY post_date DESC");
   
               	if ($arcresults2) {
               		echo "<ul class=\"postspermonth\">\n";
                   	foreach ($arcresults2 as $arcresult2) {
                      		if ($arcresult2->post_date != '0000-00-00 00:00:00') {
                        		$url       = get_permalink($arcresult2->ID);
                        		$arc_title = $arcresult2->post_title;
   
                        		if ($arc_title) $text = strip_tags($arc_title);
                           	else $text = $arcresult2->ID;
   
                          		echo "<li>".get_archives_link($url, $text, '');
       						$comments = mysql_query("SELECT * FROM " . $wpdb->comments . " WHERE comment_post_ID=" . $arcresult2->ID);
       						$comments_count = mysql_num_rows($comments);
       						if ($arcresult2->comment_status == "open" OR $comments_count > 0) echo '&nbsp;('.$comments_count.')';
       						echo "</li>\n";
                        	}
                   	}
                   	echo "</ul>\n";
               	}
       		}
       	}
       }
   
       /**
        * Function BX_get_recent_posts
        * ------------------------------------------------------
        * Outputs an unorderd list of the most recent posts.
        *
        * $current_id		this post will be excluded
        * $limit			max. number of posts
        */
   
       function BX_get_recent_posts($current_id, $limit)
       {
       	global $wpdb;
           $posts = $wpdb->get_results("SELECT ID, post_title FROM " . $wpdb->posts . " WHERE post_status='publish' AND post_type='post' ORDER BY post_date DESC LIMIT " . $limit);
           foreach ($posts as $post) {
           	$post_title = stripslashes($post->post_title);
               $permalink  = get_permalink($post->ID);
               if ($post->ID != $current_id) echo "<li><a href=\"" . $permalink . "\">" . $post_title . "</a></li>\n";
           }
       }
   
       /**
        * ------------------------------------------------------
        * Used for posts in the archive
        */
   
       function BX_shift_down_headlines($text)
       {
       	$text = apply_filters('the_content', $text);
       	$text = preg_replace("/h5>/","h6>",$text);
       	$text = preg_replace("/h4>/","h5>",$text);
       	$text = preg_replace("/h3>/","h4>",$text);
       	echo $text;
       }
   
       /**
        * Function BX_remove_p
        * ------------------------------------------------------
        * Removes the opening <p> and closing </p> from $text
        * Used for the short about text on the front page
        */
   
       function BX_remove_p($text)
       {
       	$text = apply_filters('the_content', $text);
           $text = preg_replace("/^[\t|\n]?<p>(.*)/","\\1",$text); // opening <p>
           $text = preg_replace("/(.*)<\/p>[\t|\n]$/","\\1",$text); // closing </p>
           return $text;
       }
       ?>
       <?php
       // No CSS, just IMG call
   
       define('HEADER_TEXTCOLOR', '006163');
       define('HEADER_IMAGE', '%s/images/spring_flavour/header_bg.jpg'); // %s is theme dir uri
       define('HEADER_IMAGE_WIDTH', 900);
       define('HEADER_IMAGE_HEIGHT', 150);
   
       function nigarila_admin_header_style() {
       ?>
       <style type="text/css">
       #headimg {
       	background: url(<img src="http://i254.photobucket.com/albums/hh81/tjwoz23/2020no_conf-1-2.gif" border="0" alt="Photobucket"></a>) no-repeat;
       }
       #headimg {
       	height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
       	width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
       }
       #headimg h1
       {
       	margin:0px;
       	padding: 30px 0 0 10px;
       	font-size: 2.5em;
       }
       #headimg h1 a
       {
       	color:#<?php header_textcolor();?>;
       	text-decoration:none;
       	border:0;
       }
       #headimg #desc {
       	display: none;
       }
   
       </style>
       <?php
       }
       function nigarila_header_style() {
       ?>
       <style type="text/css">
       #header {
       	background: url(<?php header_image(); ?>) no-repeat;
         height:200px;
         padding:0 0 0 18px;
       }
       #header h1 a
       {
         color:#<?php header_textcolor();?>;
       }
       </style>
       ```
   

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

 *  [ody3307](https://wordpress.org/support/users/ody3307/)
 * (@ody3307)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/parse-error-question/#post-946109)
 * Which line is 162? I don’t really want to count them to find the error.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [17 years, 3 months ago](https://wordpress.org/support/topic/parse-error-question/#post-946117)
 * The last one.
 * Why is your CSS in the functions.php file and not the style.css?
 *  [ody3307](https://wordpress.org/support/users/ody3307/)
 * (@ody3307)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/parse-error-question/#post-946119)
 * I’ve never seen code written like this.
 * You have a function that starts on line 150 and never closes.
 *  Thread Starter [johnsoncenter](https://wordpress.org/support/users/johnsoncenter/)
 * (@johnsoncenter)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/parse-error-question/#post-946238)
 * I’m new to HTML and website design and have probably messed it up, thanks for
   the find. I will try to fix it.

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

The topic ‘Parse error question’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [johnsoncenter](https://wordpress.org/support/users/johnsoncenter/)
 * Last activity: [17 years, 3 months ago](https://wordpress.org/support/topic/parse-error-question/#post-946238)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
