Assistance Appreciated - Parse error: syntax error, unexpected T_VARIABLE

Hey, I just started using WordPress - I’m a complete newbie, and am super perplexed by this error I’m getting in functions.php. I’m hoping I am just making a simple mistake, but I’d really appreciate some suggestions as to what the issue is.

The error:
Parse error: syntax error, unexpected T_VARIABLE in /homepages/33/d123623052/htdocs/rap3/wp-content/themes/business-turnkey/functions.php on line 196

That line would be at the very bottom of my code. From what I can tell, this error occurs when the code is missing a punctuation mark like a [ ( { , ’ etc. I’ve been looking over the code for ages, and from what I can see all the brackets have a matching end, there’s no out of place punctuation.

[php]<?php

define(‘THEME_URI’, get_stylesheet_directory_uri());
define(‘THEME_IMAGES’, THEME_URI . ‘/assets/img’);
define(‘THEME_CSS’, THEME_URI . ‘/assets/css’);
define(‘THEME_JS’, THEME_URI . ‘/assets/js’);
define(‘THEME_TEMPLATES’, THEME_URI . ‘/assets/templates’);

$GLOBALS[‘content_width’] = 900;

/* Define Theme Defaults */
$options = get_option(‘turnkey_theme_options’);
if($options[‘templatestyle’] == null)
$options[‘templatestyle’] = ‘modern’;
if($options[‘typography’] == null)
$options[‘typography’] = ‘typography1’;

function turnkeySlider() {

    $options = get_option('turnkey_theme_options');  
           
    if($options['sliderTimer'] != null)
        $rotateTimer = $options['sliderTimer'];
    else
        $rotateTimer = 5000;

?>

<script type="text/javascript" charset="utf-8">    
jQuery(document).ready(function($) {  
    $('.slide-container').cycle({ fx: 'scrollHorz',next: '#slide-nav .next',prev: '#slide-nav .prev',pause: 1, timeout:<?php echo $rotateTimer; ?>});    
});
</script>
<?php } add_action('wp_head', 'turnkeySlider'); require_once ( get_stylesheet_directory() . '/theme-options.php' ); require_once ( 'slider/turnkey-slider.php' ); if (function_exists('register_sidebar')) { register_sidebar(array( 'name'=> 'Homepage Widgets', 'id' => 'homepage_widgets', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name'=> 'Sidebar 1', 'id' => 'sidebar_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name'=> 'Sidebar 2', 'id' => 'sidebar_2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name'=> 'Footer Widgets', 'id' => 'footer-widgets', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } if ( function_exists( 'register_nav_menus' ) ) { register_nav_menus( array( 'turnkey_mainnav' => 'TurnKey Main Navigation', 'turnkey_secondary' => 'TurnKey Secondary Navigation' ) ); }; add_theme_support( 'post-thumbnails' ); // Makes Sure thumbnails show up in RSS function do_post_thumbnail_feeds($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '
' . get_the_post_thumbnail($post->ID) . '
' . $content; } return $content; } add_filter('the_excerpt_rss', 'do_post_thumbnail_feeds'); add_filter('the_content_feed', 'do_post_thumbnail_feeds'); // Define Thumbnail Images Sizes if ( function_exists( 'add_image_size' ) ) { add_image_size( 'post-thumb-threecol', 390, 200, true ); add_image_size( 'post-thumb-onetwocol', 520, 200, true ); /* Slide Image */ add_image_size( 'special', 580, 340, true ); } if ( !is_admin() ) { // instruction to only load if it is not the admin area function googlejquery() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'); } add_action('init', 'googlejquery'); wp_register_script('functions', get_bloginfo('template_directory') . '/assets/js/functions.js'); wp_register_script('cycle', get_bloginfo('template_directory') . '/assets/js/cycle.min.js'); wp_register_script('lightbox', get_bloginfo('template_directory') . '/assets/js/lightbox_me.js'); // enqueue the script wp_enqueue_script('jquery'); wp_enqueue_script('functions'); wp_enqueue_script('cycle'); wp_enqueue_script('lightbox'); }; function the_breadcrumb() { if (!is_home()) { echo ''; bloginfo('name'); echo " » "; if (is_category() || is_single()) { the_category('title_li='); if (is_single()) { echo " » "; the_title(); } } elseif (is_page()) { echo " "; echo the_title(); echo " "; } } } function rap_register_sidebars() { register_sidebar(array( 'name' => 'Scheduling campaign sidebar', 'id' => 'rap-scheduling-sidebar', 'description' => 'Sidebar for Scheduling Campaign template pages only.', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } // Add Automatic Feed Links add_theme_support('automatic-feed-links'); add_filter('widget_text', 'do_shortcode'); add_action('widgets_init', 'rap_register_sidebars'); // Below added by Jessica 6/24/13 to display Salesforce lookup fields on Gravity Forms field mapping page add_filter('gf_salesforce_skip_reference_types', '__return_false'); // Below added by Jessica to change the field value on the Join Us and Training forms add_action("gform_pre_submission_1", "pre_submission_JoinUs"); add_action("gform_pre_submission_8", "pre_submission_Training"); add_action("gform_pre_submission_15", "pre_submission_HCAP"); function pre_submission_JoinUs($form){ if ($_POST["input_15"] == 'Former Retail Worker') $_POST["input_15"] = 'Retail Worker'; } function pre_submission_Training($form){ if ($_POST["input_18"] == 'Former Retail Worker') $_POST["input_18"] = 'Retail Worker'; } function pre_submission_HCAP($form){ if ($_POST["input_15"] == 'Former Retail Worker') $_POST["input_15"] = 'Retail Worker'; } ?>

[/php]

Well, Mot, almost always this error is due from either a missing ending semicolon, a missing quote or quite
often a miss-matched quote or double-quotes. A quick look at the code shows no missing ending “;” and
no miss-matched quotes. The only programming issue is the first if-else you have. It does not have the
braces around the sections… If (cond) command ELSE command … Not good form, should be more like
If (cond) { command } ELSE { command } … You did use this format later on in the code.

Sorry, just a minor issue, not a solution to your code program. But, it is the only odd thing I see in the code.
Therefore, it must be one of the outputs of the functions you are using. ALL of the code you showed us is
function code, not where the output is created. In WP, there are two parts of the code, the behind the
scenes function codes and the actual page where the outputs of the functions are displayed. Without
seeing ALL of the code, it is hard to locate the one parsing error.

Now, there is a way to debug this to find the errors and other “unseen” errors which you are not aware
of as yet. You can go to the page that throws out the error. Copy the URL in the address bar. This will
contain any arguments that are being posted to the browser too. With that URL copied, go to the WWW
site validation site and paste it into the site and validate the page. It will show you all of your errors and
hopefully will show where it fails. They also have one just for CSS and one for PHP code, too. You have to
enter these using the entire page of code that you are checking and it sometimes fails if you use session
variables or need passwords entered. But, usually, the first one will find your biggest errors.

Hope this helps! Let us know what it finds for errors… Good luck.
http://validator.w3.org/

Sponsor our Newsletter | Privacy Policy | Terms of Service