Title: Error in functions.php after adding code
Last modified: August 22, 2016

---

# Error in functions.php after adding code

 *  Resolved [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/)
 * I am trying to add the ability for users to add a custom footer image in the 
   Theme Customizer. Followed the tutorial at ottopress.com, and the code I added
   to functions.php (below) is at lines 8-54. The message I get when I use a code
   checker is:
 * Parse error: syntax error, unexpected $end in CODE on line 133
    Errors parsing
   CODE
 * I am not very good at PHP, in fact pretty much a brand-newbie. Up to now I’ve
   been just messing around a little bit but mostly copying/pasting. I have already
   started studying it but I want to fix this NOW. Can someone help me pleeeeeeeeeeze?
 * Site – [http://rosecitygardens.com/testsite/wordpress/](http://rosecitygardens.com/testsite/wordpress/)(
   note that I took the revised function file out and it’s using the original now).
 * Here is my revised that keeps throwing an error:
 *     ```
       <?php
       add_action( 'after_setup_theme', 'coronado_setup' );
       function coronado_setup()
       {
       load_theme_textdomain( 'coronado', get_template_directory() . '/languages' );
       add_theme_support( 'automatic-feed-links' );
       add_theme_support( 'post-thumbnails' );
       $wp_customize->add_section( 'coronado_footer' , array(
           'title'      => __('Custom Footer','coronado'),
           'width'         => 710,
       	'height'        => 55,
       	'default-image' => get_template_directory_uri() . '/images/coronado-bottom.jpg',
       	'uploads'       => true,
           'transport'     => 'postMessage'
       ) );
   
       $wp_customize->add_setting( 'coronado_footer', array(
           'default'        => '',
           'type'           => 'theme_mod',
           'capability'     => 'edit_theme_options',
       ) );
   
       $wp_customize->add_control( WP_Customize_Image_Control( $wp_customize,
        array(
           'label'   => __( 'Custom Footer', 'coronado' ),
           'section' => 'coronado_footer',
           'settings'   => 'coronado_theme_options[coronado_footer]',
       ) ) );
   
       add_action( 'customize_register', 'coronado_customize_register' );
       function coronado_customize_register($wp_customize) {
       $wp_customize->add_section( 'coronado_footer_image', array(
           'title'      => __('Custom Footer','coronado'),
           'width'         => 710,
       	'height'        => 55,
       	'default-image' => get_template_directory_uri() . '/images/coronado-bottom.jpg',
       	'uploads'       => true,
           'priority'       => 35,
       ) );
       if ( $wp_customize->is_preview() && ! is_admin() )
           add_action( 'wp_footer', 'coronado_customize_preview', 21);
       function themename_customize_preview() {
           ?>
           <script type="text/javascript">
           ( function( $ ){
           wp.customize('setting_name',function( value ) {
               value.bind(function(to) {
                   $('#footer-pic').css('background-image', to ? to : '' );
               });
           });
           } )( jQuery )
           </script>
           <?php
       }
       $args = array(
       	'width'         => 710,
       	'height'        => 225,
       	'default-image' => get_template_directory_uri() . '/images/coronado.jpg',
       	'uploads'       => true,
       );
       add_theme_support( 'custom-header', $args );
       $defaults = array(
       	'default-color'          => '',
       	'default-image'          => '',
       	'default-repeat'         => '',
       	'default-position-x'     => '',
       	'wp-head-callback'       => '_custom_background_cb',
       	'admin-head-callback'    => '',
       	'admin-preview-callback' => ''
       );
       add_theme_support( 'custom-background', $defaults );
       global $content_width;
       if ( ! isset( $content_width ) ) $content_width = 640;
       register_nav_menus(
       array( 'main-menu' => __( 'Main Menu', 'coronado' ) )
       );
       }
       function greenapples_add_editor_styles() {
           add_editor_style( 'custom-editor-style.css' );
       }
       add_action( 'wp_enqueue_scripts', 'coronado_load_scripts' );
       function coronado_load_scripts()
       {
       wp_enqueue_script( 'jquery' );
       }
       add_action( 'comment_form_before', 'coronado_enqueue_comment_reply_script' );
       function coronado_enqueue_comment_reply_script()
       {
       if ( get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }
       }
       add_filter( 'the_title', 'coronado_title' );
       function coronado_title( $title ) {
       if ( $title == '' ) {
       return '&rarr;';
       } else {
       return $title;
       }
       }
       add_filter( 'wp_title', 'coronado_filter_wp_title' );
       function coronado_filter_wp_title( $title )
       {
       return $title . esc_attr( get_bloginfo( 'name' ) );
       }
       add_action( 'widgets_init', 'coronado_widgets_init' );
       function coronado_widgets_init()
       {
       register_sidebar( array (
       'name' => __( 'Sidebar Widget Area', 'coronado' ),
       'id' => 'primary-widget-area',
       'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
       'after_widget' => "</li>",
       'before_title' => '<h3 class="widget-title">',
       'after_title' => '</h3>',
       ) );
       }
       function coronado_custom_pings( $comment )
       {
       $GLOBALS['comment'] = $comment;
       ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"><?php echo comment_author_link(); ?></li>
       <?php
       }
       add_filter( 'get_comments_number', 'coronado_comments_number' );
       function coronado_comments_number( $count )
       {
       if ( !is_admin() ) {
       global $id;
       $comments_by_type = &separate_comments( get_comments( 'status=approve&post_id=' . $id ) );
       return count( $comments_by_type['comment'] );
       } else {
       return $count;
       }
       }
       ```
   
 * I accidentally used the wrong file, corrected. 🙂

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

 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278880)
 * Can you post the entirety of your edited `functions.php` to [Pastebin](http://pastebin.com/)
   and post the link here?
 *  Thread Starter [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278925)
 * Thank you Stephen. Here’s the link:
 * [http://pastebin.com/H8STYS9T](http://pastebin.com/H8STYS9T)
 *  Thread Starter [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278926)
 * I might add that when I check each piece of code separately, the code that I 
   added and the original functions.php, I don’t get an error on either.
 *  Thread Starter [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278931)
 * Code added is on lines 28-73, I don’t know what I was looking at before.
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278938)
 * I don’t see `$end` anywhere in your `functions.php`. What code checker did you
   use?
 *  Thread Starter [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278940)
 * [http://www.piliapp.com/php-syntax-check/](http://www.piliapp.com/php-syntax-check/)
 *  Thread Starter [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278943)
 * I don’t think it’s the word $end they’re talking about. I think it might have
   something to do with brackets. But I checked the syntax over and over again. 
   🙁
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278945)
 * You were missing two ending brackets at the beginning of the file and you appeared
   to have some redundant code at lines 28-49. I cleaned it up a bit and pasted 
   it at [http://pastebin.com/NH6rsnbh](http://pastebin.com/NH6rsnbh). Give it a
   try.
 * As a side note, when I pasted your original code into my WordPress installation,
   I got the error message “Parse: syntax error, unexpected end of file”, which 
   would have been a lot more useful.
 *  Thread Starter [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278951)
 * Well, I don’t have an error now but I still didn’t accomplish what I wanted to
   do, which was add the ability to change the footer image in the Theme Customizer.
   I’ve been at this all day. 🙁
 * Thanks for your help. You wouldn’t happen to know what I’m doing wrong, would
   you?
 *  Thread Starter [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * (@rosecitysister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278959)
 * Actually, I’ll post another topic about this, I think that would be better. Thanks
   for your help!

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

The topic ‘Error in functions.php after adding code’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [syntax error](https://wordpress.org/support/topic-tag/syntax-error/)
 * [theme customizer](https://wordpress.org/support/topic-tag/theme-customizer/)

 * 10 replies
 * 2 participants
 * Last reply from: [RoseCitySister](https://wordpress.org/support/users/rosecitysister/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/error-in-functionsphp-after-adding-code/#post-5278959)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
