WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Parse error: syntax error, unexpected T_FUNCTION (8 posts)

  1. danmaj1990
    Member
    Posted 1 year ago #

    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';
    
    ?>
  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Try re-uploading a fresh, unpacked, copy of the your theme's folder to wp-content/themes using FTP 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 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.

  3. danmaj1990
    Member
    Posted 1 year ago #

    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?

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    If you read the error message, you'll see that it's clearly an issue in your theme's functions.php file.

  5. danmaj1990
    Member
    Posted 1 year ago #

    I know that... But I'm a complete novice when it comes to .php, hence why I am on here.

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    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.

  7. amcarr11890
    Member
    Posted 7 months ago #

    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!

  8. WPyogi
    Volunteer Moderator
    Posted 7 months ago #

    @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

Topic Closed

This topic has been closed to new replies.

About this Topic