1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Parse error: syntax error, unexpected?

Discussion in 'PHP & Perl' started by Phunky, Aug 3, 2014.

  1. Phunky

    Phunky Regular Member

    Joined:
    Aug 23, 2009
    Messages:
    292
    Likes Received:
    82
    Occupation:
    Sales
    Location:
    USA
    When I try to activate my theme on WordPress I get this error:

    Parse error: syntax error, unexpected '{' in /home3/removed/public_html/wp-content/themes/gameaddict/themeOptions/functions.php on line 1

    The code in the file is:

    Code:
    <?phpif ( !function_exists( 'optionsframework_init' ) ) {
    /*-----------------------------------------------------------------------------------*/
    /* Options Framework Theme
    /*-----------------------------------------------------------------------------------*/
    /* Set the file path based on whether the Options Framework Theme is a parent theme or child theme */
    
    
        define('OPTIONS_FRAMEWORK_URL', get_template_directory() . '/themeOptions/admin/');
        define('OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/themeOptions/admin/');
    
    
    require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
    }
    /*
     * This is an example of how to add custom scripts to the options panel.
     * This one shows/hides the an option when a checkbox is clicked.
     */
    add_action('optionsframework_custom_scripts', 'optionsframework_custom_scripts');
    function optionsframework_custom_scripts() { ?>
    <script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery('#example_showhidden').click(function() {
              jQuery('#section-example_text_hidden').fadeToggle(400);
        });
        if (jQuery('#example_showhidden:checked').val() !== undefined) {
            jQuery('#section-example_text_hidden').show();
        }
    });
    </script>
    <?php
    }
    /*
     * Turns off the default options panel from Twenty Eleven
     */
    add_action('after_setup_theme','remove_twentyeleven_options', 100);
    function remove_twentyeleven_options() {
        remove_action( 'admin_menu', 'twentyeleven_theme_options_add_page' );
    }
    ?>
    
    Any idea why this error is occuring?
     
  2. qrazy

    qrazy Senior Member

    Joined:
    Mar 19, 2012
    Messages:
    1,111
    Likes Received:
    1,712
    Location:
    Banana Republic
    "<?phpif " should be "<?php if " on line 1
     
    • Thanks Thanks x 1
  3. Phunky

    Phunky Regular Member

    Joined:
    Aug 23, 2009
    Messages:
    292
    Likes Received:
    82
    Occupation:
    Sales
    Location:
    USA
    Thank you so much! I am passed that, but now getting:


    Fatal error: Cannot redeclare addict_page_builder() (previously declared in /home3/removed/public_html/wp-content/themes/gameaddict/functions.php:28) in /home3/removed/public_html/wp-content/themes/gameaddict/themeOptions/functions.php on line 29


    I obviously don't know anything about PHP, but I don't see anything even being declared on line 28 or 29?
     
  4. Schvamp

    Schvamp Power Member

    Joined:
    Feb 13, 2012
    Messages:
    684
    Likes Received:
    549
    Location:
    Hogwarts
    Edit: I was wrong
     
    Last edited: Aug 3, 2014
  5. Phunky

    Phunky Regular Member

    Joined:
    Aug 23, 2009
    Messages:
    292
    Likes Received:
    82
    Occupation:
    Sales
    Location:
    USA
    Well, I just can't seem to get it working. Here is the theme if anyone wants to give it a shot: Download