Error in functions.php 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 CODEI 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/ (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 '→'; } 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. π
The topic ‘Error in functions.php after adding code’ is closed to new replies.