1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Parse error: syntax error, unexpected HELP!!!

Discussion in 'PHP' started by A80R, Mar 13, 2013.

  1. #1
    I am freaking out, I was trying to confirm something in my account, and then I got this error and now I am totally locked out of doing anything in my blog. I keep getting this error on a white screen:

    Parse error: syntax error, unexpected '<' in /home/azcubed/public_html/wp-content/themes/happychevron/functions.php on line 2

    My page was working fine, and now I can't open anything. I really don't know what to do. This is the code in the PHP file. I am not a coder, so please be specific in telling me what to fix.


    
    <?php
    /** Start the engine */
    require_once( get_template_directory() . '/lib/init.php' );
     
    /** Remove the post meta function */
    remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
     
    remove_action('genesis_meta', 'genesis_load_favicon');
     
    /** Child theme (do not remove) */
    define( 'CHILD_THEME_NAME', 'happychevron' );
    define( 'CHILD_THEME_URL', 'http://www.beautifuldawndesigns.net' );
     
    /** Add new image sizes */
    add_image_size( 'post-photo', 660, 250, true );
     
    /** Add support for custom background */
    add_custom_background();
     
    /** Add support for custom header */
    add_theme_support( 'genesis-custom-header', array( 'width' => 1000, 'height' => 300 ) );
     
    /** Unregister secondary navigation menu */
    add_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'genesis' ) ) );
     
    // Customize search
    add_filter('genesis_search_text', 'happychevron_search_text');
    function happychevron_search_text($text) {
    return esc_attr('Search the site...');
    }
     
    add_filter('genesis_search_button_text', 'happychevron_search_button_text');
    function happychevron_search_button_text($text) {
    return esc_attr('Search');
    }
     
    /** Add support for 3-column footer widgets */
    add_theme_support( 'genesis-footer-widgets', 3 );
     
    /** Customize the post info function */
    add_filter( 'genesis_post_info', 'post_info_filter' );
    function post_info_filter( $post_info ) {
     
    if ( ! is_page() ) {
    return 'By [post_author_posts_link] &middot; [post_comments] [post_edit]';
    }
     
    return $post_info;
     
    }
     
    /** Customize the post meta function */
    add_filter('genesis_post_meta', 'post_meta_filter');
    function post_meta_filter($post_meta) {
     
    if ( ! is_page() ) {
    return '[post_categories before="Filed Under: "] &middot; [post_tags before="Tagged: "]';
    }
     
    return $post_meta;
     
    }
     
    /** Customize the credits */
    add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
    function custom_footer_creds_text($creds) {
    $creds = 'Copyright &copy; 2012 &middot; Designed by <a href="http://www.beautifuldawndesigns.net" title="Beautiful Dawn Designs">beautiful dawn designs</a>';
    return $creds;
    }
     
    /** Add date block before post title */
    add_action( 'genesis_before_post_title', 'custom_post_date' );
    function custom_post_date() {
     
    if ( ! is_page() ) {
    echo '<div class="post-date">';
    echo do_shortcode( '[post_date format="M j, Y"]' );
    echo '</div><!-- end .post-date -->';
    }
     
     
    }
    
    PHP:
    PLEASE help me!!!
     
    Last edited by a moderator: Mar 13, 2013
    A80R, Mar 13, 2013 IP
  2. peter_anderson

    peter_anderson Notable Member

    Messages:
    3,382
    Likes Received:
    152
    Best Answers:
    0
    Trophy Points:
    240
    #2
    Have you tried removing the blank line at the top of the page? (The <?php starts on line 2 in your example).
     
    peter_anderson, Mar 13, 2013 IP
  3. VideoWhisper.com

    VideoWhisper.com Well-Known Member

    Messages:
    330
    Likes Received:
    6
    Best Answers:
    2
    Trophy Points:
    113
    Digital Goods:
    2
    #3
    Yes, try removing any characters before <?php
     
    VideoWhisper.com, Mar 17, 2013 IP
  4. dombo

    dombo Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    Trying to close "<?php" at the end of code.
     
    dombo, Mar 18, 2013 IP
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #5
    You should still be able to access wp admin... change your theme temporarily and contact the theme creators, you paid for it, I'm sure they have a support system/forum.
     
    MyVodaFone, Mar 18, 2013 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #6
    Some of your add_filter calls are done before the function they are passing is defined, swapping those around might help...

    but to be honest, I'd half suspect some sort of character encoding error as the cause here... going through, adding actual proper tabbed indents (dunno if the forum stripped them, or the code is just trash), and all the quotes and brackets match up and seem properly closed; and that really leaves some form of oddball character encoding or other bug as the cause....

    Is this file called directly, or is it included from something else? no, that wouldn't be it either. What are you using for an editor? Have you switched editors or used many different editors that could have corrupted the character set somehow? (or done something silly like loaded the code in word/wordpad/ooo?)

    You might also want to clean up some of the unnecessary code bits like the multiple echo doing the job of one and get some proper formatting in there -- though that appears unrelated to your issue. (also, copyright &copy; -- REALLY? It's copyright copyright? :D )
     
    deathshadow, Mar 19, 2013 IP
  7. wiicker95

    wiicker95 Well-Known Member

    Messages:
    438
    Likes Received:
    37
    Best Answers:
    10
    Trophy Points:
    100
    #7
    First of all, it doesn't matter if there is blank space before the <?php opening tag, not that you should do it on purpose.

    Second of all, there is no space in the file he posted, it just adds up a space when you go to the new line from [c0de].

    We really can't tell from what we have here. Some other file is causing this, probably requiring or including the one you posted.
     
    wiicker95, Mar 19, 2013 IP
  8. Endurint

    Endurint Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #8
    What you've got there is a little problem called the byte order marker (BOM) in UTF-8 (character encoding).

    This is a problem that's commonly encountered in WordPress, and you can usually fix it by using an FTP client to upload a fresh copy of your theme's functions.php, overwriting the one that's on your server now.
     
    Endurint, Mar 19, 2013 IP