Help with syntax error, unexpected $end
-
Hi all,
Please could you help me out.
I tried installing the custom WPML language switcher code from here (https://gist.github.com/senlin/2341203 ) in my functions.php.
And now i get the following error.
Parse error: syntax error, unexpected $end in /homez.113/africatul/www/web/wp-content/themes/indus/functions.php on line 402
The following is my code:
<?php /* Functions and definitions */ /* Load custom functions, widgets and options from various files. */ include_once('includes/cats_widget.php'); include_once('includes/recent_posts_widget.php'); include_once('includes/minifolio_widget.php'); include_once('includes/popular_posts_widget.php'); include_once('includes/recent_comments_widget.php'); include_once('includes/flickr_widget.php'); include_once('includes/social_links_widget.php'); include_once('includes/twitter_widget.php'); include_once('includes/mini_slider_widget.php'); include_once('includes/content_slider_widget.php'); include_once('includes/init_custom_widgets.php'); include_once('includes/post_options.php'); include_once('includes/page_options.php'); include_once('includes/theme_admin_options.php'); include_once('includes/shortcodes/shortcodes.php'); include_once('includes/shortcodes/visual_shortcodes.php'); include'includes/post.php'; if ( !isset( $content_width ) ) $content_width = 690; /* Match Theme styles inside visual editor using editor-style.css */ add_editor_style(); /* The Theme allows users to set a custom background */ add_custom_background(); /* Add default posts and comments RSS feed links to head */ add_theme_support( 'automatic-feed-links' ); /* Add support for post thumbnails */ add_theme_support( 'post-thumbnails' ); /* Make theme available for translation */ load_theme_textdomain( 'indus', TEMPLATEPATH . '/languages' ); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); /* Add support for wp_nav_menu() */ function register_my_menu() { register_nav_menu( 'primary', __( 'Primary Menu', 'indus' ) ); } add_action( 'init', 'register_my_menu' ); /* Create and register Sidebar Widgets */ function indus_widgets_init() { register_sidebar( array( 'name' => __( 'Default Sidebar', 'indus' ), 'id' => 'default-sidebar', 'description' => __( 'The default sidebar widget area', 'indus' ), 'before_widget' => '<div class="widgetwrap">', 'after_widget' => '</div>', 'before_title' => '<h5><span>', 'after_title' => '</span></h5>' ) ); register_sidebar( array( 'name' => __( 'Default Secondary Column 1', 'indus' ), 'id' => 'secondary-column-1', 'description' => __( 'Secondary Column', 'indus' ), 'before_widget' => '<div class="widgetwrap">', 'after_widget' => '</div>', 'before_title' => '<h5><span>', 'after_title' => '</span></h5>' ) ); register_sidebar( array( 'name' => __( 'Default Secondary Column 2', 'indus' ), 'id' => 'secondary-column-2', 'description' => __( 'Secondary Column', 'indus' ), 'before_widget' => '<div class="widgetwrap">', 'after_widget' => '</div>', 'before_title' => '<h5><span>', 'after_title' => '</span></h5>' ) ); register_sidebar( array( 'name' => __( 'Default Secondary Column 3', 'indus' ), 'id' => 'secondary-column-3', 'description' => __( 'Secondary Column', 'indus' ), 'before_widget' => '<div class="widgetwrap">', 'after_widget' => '</div>', 'before_title' => '<h5><span>', 'after_title' => '</span></h5>' ) ); /* Register exclusive widget areas for each page */ $mypages = get_pages(); foreach($mypages as $pp) { $page_opts = get_post_meta( $pp->ID, 'page_options', true ); $unique_sidebar = isset($page_opts['unique_sidebar']) ? $page_opts['unique_sidebar'] : ''; if ( $unique_sidebar == 'true' ){ register_sidebar( array( 'name' => __( $pp->post_title.' Sidebar', 'indus' ), 'id' => $pp->ID.'-sidebar', 'description' => sprintf( esc_attr__( '%s Sidebar', 'indus' ), $pp->post_title ), 'before_widget' => '<div class="widgetwrap">', 'after_widget' => '</div>', 'before_title' => '<h5><span>', 'after_title' => '</span></h5>' ) ); } } } add_action( 'widgets_init', 'indus_widgets_init' ); /* Indus Comments List */ if ( ! function_exists( 'indus_comments' ) ) : function indus_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div class="commentwrapper clearfix <?php $author_id = get_the_author_meta('ID'); if($author_id == $comment->user_id) $author_flag = 'true';?>" id="comment-<?php comment_ID(); ?>"> <div class="author-card"> <?php $dir = get_template_directory_uri(); $default_avatar = $dir . '/images/default_avatar.jpg'; echo get_avatar( $comment, $size='64', $default = $default_avatar ); ?> </div> <div class="comment_data"> <p class="comment_meta"><span class="comment_author_link"><?php comment_author_link(); ?></span><span class="comment-date"><?php printf( __( '%1$s at %2$s', 'indus' ), get_comment_date(), get_comment_time() );?></span><?php if (comments_open()) { ?><span class="comment-reply"><?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __( 'Reply', 'indus' )))); ?></span><?php } edit_comment_link( __( 'Edit', 'indus' ), '<span class="edit_comment">', '</span>' ); if (isset($author_flag) && ($author_flag == 'true')) { ?><span class="author_comment"><?php _e( 'Author', 'indus' ); ?></span><?php }?></p> <?php if ($comment->comment_approved == '0') : ?><p><em><?php _e( 'Your comment is awaiting moderation.', 'indus' ); ?></em></p><?php endif; comment_text(); ?> </div><!-- .comment-data --> </div><!-- .commentwrapper --> <?php } endif; // indus comments /* Related Posts on single post pages */ function indus_related_posts( $ind_rp_taxonomy, $ind_rp_style, $ind_rp_num ) { global $post; $temp = (isset($post)) ? $post : ''; if ( $ind_rp_taxonomy == 'tags' ) { $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=> $ind_rp_num, 'ignore_sticky_posts'=>1 ); } // end if tags } //end taxonomy tags else { $categories = get_the_category($post->ID); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; $args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=> $ind_rp_num, 'ignore_sticky_posts'=>1 ); } // end if categories } // end taxonomy categories $new_query = new WP_Query($args); $list_class = ( $ind_rp_style == 'thumbnail' ) ? 'related_posts' : 'related_list'; if( $new_query->have_posts() ) { ?> <div class="entry clearfix"> <h4 class="single_headings"><?php _e( 'Related Posts', 'indus' ); ?></h4><ul class="<?php echo $list_class; ?> clearfix"> <?php while( $new_query->have_posts() ) { $new_query->the_post(); ?> <li><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permanent link to %s', 'indus' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php $post_opts = get_post_meta( $post->ID, 'post_options', true); $img = (!empty($post_opts['thumb'])) ? $post_opts['thumb'] : ''; if ( $ind_rp_style == 'thumbnail' ) { ?><img src="<?php if ( $img != '' ) { echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo $img; ?>&w=64&h=64&zc=1&q=100<?php } else { echo get_template_directory_uri(); ?>/images/post_thumb.jpg" <?php } ?> alt="<?php the_title(); ?>"/> <?php } else the_title(); ?></a></li> <?php } // while have posts echo '</ul></div>'; } // if have posts $post = $temp; wp_reset_query(); } /* Show meta information for posts*/ function indus_posted_in() { printf( __( 'by %2$s in %1$s', 'indus' ), get_the_category_list( ', ' ), sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', get_author_posts_url( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', 'indus' ), get_the_author() ), get_the_author() )); if( comments_open() ) { _e( ' with ', 'indus' ); comments_popup_link( __( '0 Comments', 'indus' ), __( '1 Comment', 'indus' ), __( '% Comments', 'indus' ), '', '' ); } edit_post_link( __( 'Edit', 'indus' ), ' · ', '' ); } function indus_attachment_meta() { printf( __( 'Posted on %1$s by %2$s', 'indus' ), get_the_time('F j, Y'), sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', get_author_posts_url( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', 'indus' ), get_the_author() ), get_the_author() )); edit_post_link( __( 'Edit', 'indus' ), ' · ', '' ); if ( wp_attachment_is_image() ) { $metadata = wp_get_attachment_metadata(); printf( __( ' · Full size is %s pixels', 'indus' ), sprintf( '<a href="%1$s" title="%2$s">%3$s × %4$s</a>', wp_get_attachment_url(), esc_attr( __( 'Link to full-size image', 'indus' ) ), $metadata['width'], $metadata['height'] ) ); } } // Shorten Any Text function short($text, $limit) { $chars_limit = $limit; $chars_text = strlen($text); $text = strip_tags($text); $text = $text." "; $text = substr($text,0,$chars_limit); $text = substr($text,0,strrpos($text,' ')); if ($chars_text > $chars_limit) { $text = $text."..."; } return $text; } /* Dynamic Page Titles on Featured Area */ function ind_page_titles(){ if ( is_category() ) { single_cat_title(); } elseif ( is_day() ) { _e( 'Daily Archives', 'indus' ); } elseif ( is_month() ) { _e( 'Monthly Archives', 'indus' ); } elseif ( is_year() ) { _e( 'Yearly Archives', 'indus' ); } elseif ( is_single() && !is_attachment() ) { $cat = get_the_category(); $cat = $cat[0]; $parent_list = get_category_parents( $cat, false, ',' ); $parent_list_array = split( ",", $parent_list ); $top_parent = $parent_list_array[0]; if( isset($top_parent) && !empty($top_parent) ) echo $top_parent; } elseif ( is_page() ) { the_title(); } elseif ( is_search() ) { _e( 'Search Results', 'indus' ); } elseif ( is_tag() ) { _e( 'Tag Archives', 'indus' ); } elseif ( is_author() ) { _e( 'Author Archives', 'indus' ); } elseif ( is_404() ) { _e( 'Error 404', 'indus' ); } elseif ( is_attachment() ) { _e( 'Attachments', 'indus' ); } else { wp_title(''); } } /* Remove auto DIV container on WP Menus */ function my_wp_nav_menu_args( $args = '' ) { $args['container'] = false; return $args; } add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); //Shortcodes autoformatting prevention //https://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode function my_formatter($content) { $new_content = ''; $pattern_full = '{(\[raw\].*?\[/raw\])}is'; $pattern_contents = '{\[raw\](.*?)\[/raw\]}is'; $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($pieces as $piece) { if (preg_match($pattern_contents, $piece, $matches)) { $new_content .= $matches[1]; } else { $new_content .= wptexturize(wpautop($piece)); } } return $new_content; } remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'my_formatter', 99); /* Comment Form Override */ function new_field($fields) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $fields = array( 'author' => '<p class="comment-form-author">' . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /><label for="author">' . __( 'Name', 'indus' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '</p>', 'email' => '<p class="comment-form-email"><input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /><label for="email">' . __( 'Email', 'indus' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '</p>', 'url' => '<p class="comment-form-url"><input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /><label for="url">' . __( 'Website', 'indus' ) . '</label></p>', ); return $fields; } add_filter('comment_form_default_fields','new_field'); // Enable short codes inside Widgets add_filter( 'widget_text', 'shortcode_unautop'); add_filter( 'widget_text', 'do_shortcode'); // Add specific CSS class to the body, depending upon the type of Layout (boxed, stretched) and Navigation position (fixed, relative) selected function custom_body_class($ind_nav_pos, $ind_layout) { $new_class = ''; if ( $ind_nav_pos == 'fixed' ) { if ( $ind_layout == 'boxed' ) $new_class = 'nav_fixed_boxed'; else $new_class = 'is_stretched nav_fixed_stretched'; } else { if ( $ind_layout == 'boxed' ) $new_class = 'nav_rel_boxed'; else $new_class = 'is_stretched nav_rel_stretched'; } return $new_class; } function utility_class($ind_nav_pos, $ind_layout) { $util_class = ''; if ( $ind_nav_pos == 'fixed' ) { $util_class = 'fixed_nav'; } else { if ( $ind_layout == 'boxed' ) $util_class = 'relative_nav'; } echo $util_class; }?>
I’ve checked to see that I have the correct opening and closing tags and cant see any errors.
Please help!!.
Thanks in advance
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Help with syntax error, unexpected $end’ is closed to new replies.