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

---

# Parse error: syntax error, unexpected T_FUNCTION

 *  Resolved [danmaj1990](https://wordpress.org/support/users/danmaj1990/)
 * (@danmaj1990)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/)
 * Hi, getting this error message:
 * Parse error: syntax error, unexpected T_FUNCTION in /home/content/19/9450819/
   html/wp-content/themes/stumblr/functions.php on line 151
 * Here is my functions.php:
 *     ```
       <?php
   
       	// Add RSS links to <head> section
       	add_theme_support('automatic-feed-links') ;
   
       	// Load jQuery
       	if ( !function_exists('core_mods') ) {
       		function core_mods() {
       			if ( !is_admin() ) {
       				wp_deregister_script('jquery');
       				wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"));
       				wp_register_script('stumblr.functions', (get_template_directory_uri()."/js/functions.js"),'jquery',false,true);
   
       				wp_enqueue_script('jquery');
       				wp_enqueue_script('stumblr.functions');
       			}
       		}
       		core_mods();
       	}
   
       	// content width
       	if ( !isset( $content_width ))  {
       		$content_width = 700;
       	}
   
       	// clean up the <head>
       	function removeHeadLinks() {
           	remove_action('wp_head', 'rsd_link');
           	remove_action('wp_head', 'wlwmanifest_link');
           }
           add_action('init', 'removeHeadLinks');
           remove_action('wp_head', 'wp_generator');
   
       	// Stumblr post thumbnails
       	add_theme_support( 'post-thumbnails' );
       		add_image_size('stumblr-large-image', 740, 9999);
   
       	// menu fallback
   
       	function stumblr_addmenus() {
       	register_nav_menus(
       		array(
       			'main_nav' => 'Main Menu',
       			)
       			);
       	}
   
       	add_action( 'init', 'stumblr_addmenus' );
   
       	function stumblr_nav() {
       		if ( function_exists( 'wp_nav_menu' ) )
       			wp_nav_menu( 'menu=main_nav&container_class=pagemenu&fallback_cb=stumblr_nav_fallback' );
       		else
       			stumblr_nav_fallback();
       	}
   
       	function stumblr_nav_fallback() {
       		echo '<li><a href="';
       		echo home_url( '/' );
       		echo '">Home</a></li>';
       		wp_list_pages("depth=1&title_li=");
       	}
   
            //setup footer widget area
       	if (function_exists('register_sidebar')) {
           	register_sidebar(array(
           		'name' => 'Side Widgets',
           		'id'   => 'stumblr_widgets',
           		'description'   => 'Side Widget Area',
           		'before_widget' => '<div id="%1$s" class="side-widget %2$s">',
           		'after_widget'  => '</div>',
           		'before_title'  => '<h3>',
           		'after_title'   => '</h3>'
           	));
   
       		register_sidebar(array(
           		'name' => 'Footer Widgets',
           		'id'   => 'stumblr_footer',
           		'description'   => 'Footer Widget Area',
           		'before_widget' => '<div id="%1$s" class="footer-widget %2$s">',
           		'after_widget'  => '</div>',
           		'before_title'  => '<h3>',
           		'after_title'   => '</h3>'
           	));
   
       	}
   
         // video width
   
       	add_filter('embed_defaults', 'custom_embed_defaults');
       	function custom_embed_defaults($embed_size) {
       		if (is_single()) { // Conditionally set max height and width
       			$embed_size['width'] = 740;
       			$embed_size['height'] = 740;
       		} else {           // Default values
       			$embed_size['width'] = 740;
       			$embed_size['height'] = 740;
       		}
       		return $embed_size; // Return new size
       	}
   
          // pagination
   
         function stumblr_pagination($pages = '', $range = 2) {
            $showitems = ($range * 2)+1;  
   
            global $paged;
            if(empty($paged)) $paged = 1;
   
            if($pages == '')
            {
                global $wp_query;
                $pages = $wp_query->max_num_pages;
                if(!$pages)
                {
                    $pages = 1;
                }
            }   
   
            if(1 != $pages)
            {
                echo "<div class='stuumblr-pagination'>";
                if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
                if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";
   
                for ($i=1; $i <= $pages; $i++)
                {
                    if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
                    {
                        echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>";
                    }
                }
   
                if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>&rsaquo;</a>";
                if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";
                echo "</div>\n";
            }
       	}
   
       	// Stumblr theme options
       	include 'options/admin-menu.php';
   
       ?>
       ```
   

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3674728)
 * Try re-uploading a fresh, unpacked, copy of the your theme’s folder to wp-content/
   themes using [FTP](http://codex.wordpress.org/FTP_Clients) or whatever file management
   application your host provides. If that’s not possible, try switching to the 
   default theme by renaming your current theme’s folder inside wp-content/themes
   and adding “-old” to the end of the folder name using [FTP](http://codex.wordpress.org/FTP_Clients)
   or whatever file management application your host provides.
 * Finally, as you are using a non-WPORG theme, you will seek support for this theme
   from the theme’s developers – paid or otherwise. We only support themes downloaded
   from wordpress.org here.
 *  Thread Starter [danmaj1990](https://wordpress.org/support/users/danmaj1990/)
 * (@danmaj1990)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3674730)
 * Oh, I thought it was a general wordpress problem, not individual to my theme.
 * I tried pasting in the original .php file but it still comes up with the same
   error?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3674735)
 * If you read the error message, you’ll see that it’s clearly an issue in your 
   theme’s functions.php file.
 *  Thread Starter [danmaj1990](https://wordpress.org/support/users/danmaj1990/)
 * (@danmaj1990)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3674737)
 * I know that… But I’m a complete novice when it comes to .php, hence why I am 
   on here.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3674743)
 * As it stands, all I can suggest is that you try switching to the default theme
   by renaming your current theme’s folder inside wp-content/themes and adding “-
   old” to the end of the folder name using FTP or whatever file management application
   your host provides. That should get you back into your site. Then delete your
   old theme & try [looking for a better theme](http://wordpress.org/extend/themes/).
 *  [amcarr11890](https://wordpress.org/support/users/amcarr11890/)
 * (@amcarr11890)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3675014)
 * Hi!
 * I am new to wordpress, the website I’m running was passed down to me. I tried
   downloading a new theme, and now whenever I type in my url I get this error message:
 * Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION
   or T_VAR or ‘}’ in /home/unhgy0/public_html/wp-content/themes/x2/admin/library.
   php on line 138
 * I have no idea what happened, and I have no access to the website at all anymore.
 * PLEASE HELP!
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3675015)
 * **[@amcarr11890](https://wordpress.org/support/users/amcarr11890/)** – please
   start a new thread – this one is marked resolved, not the same issue and ten 
   months old. You can do so here:
 * [http://wordpress.org/support/forum/how-to-and-troubleshooting#postform](http://wordpress.org/support/forum/how-to-and-troubleshooting#postform)

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

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

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [problem](https://wordpress.org/support/topic-tag/problem/)
 * [T_FUNCTION](https://wordpress.org/support/topic-tag/t_function/)
 * [Unexpected](https://wordpress.org/support/topic-tag/unexpected/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 4 participants
 * Last reply from: [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-5/#post-3675015)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
