WordPress.org

Ready to get started?Download WordPress

Forums

Parse error: syntax error, unexpected T_CLASS (4 posts)

  1. TravMoody
    Member
    Posted 10 months ago #

    Parse error: syntax error, unexpected T_CLASS in /home/content/15/9285015/html/wp-content/themes/sancho/widgets/san-featured-posts.php on line 61

    There's something different around where the comment line is, although the error comments on: THANKS!

    <?php
    
    if ( function_exists('add_image_size') )
    {
    	$sizes = get_option('ktt__cat_post_thumb_sizes');
    	if ( $sizes )
    	{
    		foreach ( $sizes as $id=>$size )
    			add_image_size( 'cat_post_thumb_size' . $id, $size[0], $size[1], true );
    	}
    }
    
    class CategoryPosts extends WP_Widget {
    
    function CategoryPosts() {
    	parent::WP_Widget(false, $name='Sancho Featured Posts');
    }
    
    function widget($args, $instance) {
    	global $post;
    	$post_old = $post;
    
    	extract( $args );
    
    	$sizes = get_option('ktt__cat_post_thumb_sizes');
    
    	if( !$instance["title"] ) {
    		$category_info = get_category($instance["cat"]);
    		$instance["title"] = $category_info->name;
    	}
    
    	$cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"]);
    
    	$new_excerpt_length = create_function('$length', "return " . $instance["excerpt_length"] . ";");
    	if ( $instance["excerpt_length"] > 0 )
    		add_filter('excerpt_length', $new_excerpt_length);
    
    	echo $before_widget;
    
    	echo '<h3>' . $instance["title"] . '</h3>';
    
    	while ( $cat_posts->have_posts() )
    	{
    		$cat_posts->the_post();
    	?>
    		<div class="cat-post-item">
    
    		<?php if ( function_exists('the_post_thumbnail') && current_theme_supports("post-thumbnails") && has_post_thumbnail() ) : ?>
    			<div class="imagen-sidebar-div">
    				<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"></a>
    				<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('sidebar'); ?></a>
    			</div>
    			<?php endif; ?>
    
    			<div class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></div>
    			<p class="post-meta"><?php the_time('F j, Y'); ?></p>
    		<strong>	<a href="<?php the_permalink()
    Comments</a>
    
    ?>#comments" title="Comments"><?php comments_number('0','1','%'); ?> </strong>
    
    			<div class="cat-post-content">
    			<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
    				<?php if ( $instance['excerpt'] ) : ?>
    				<?php the_excerpt(); ?>
    				<?php endif; ?>
    			</a>
    			</div>
    		</div>
    	<?php
    
    	echo $after_widget;
    
    	remove_filter('excerpt_length', $new_excerpt_length);
    
    	$post = $post_old;
    }
    
    function update($new_instance, $old_instance) {
    	return $new_instance;
    }
    
    function form($instance) {
    ?>
    	<p>
    		<label for="<?php echo $this->get_field_id("title"); ?>">
    			<?php _e( 'Title' ); ?>:
    			<input class="widefat" id="<?php echo $this->get_field_id("title"); ?>" name="<?php echo $this->get_field_name("title"); ?>" type="text" value="<?php echo esc_attr($instance["title"]); ?>" />
    		</label>
    	</p>
    
    	<p>
    		<label>
    			<?php _e( 'Category' ); ?>:
    			<?php wp_dropdown_categories( array( 'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?>
    		</label>
    	</p>
    
    	<p>
    		<label for="<?php echo $this->get_field_id("excerpt"); ?>">
    			<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("excerpt"); ?>" name="<?php echo $this->get_field_name("excerpt"); ?>"<?php checked( (bool) $instance["excerpt"], True ); ?> />
    			<?php _e( 'Show post excerpt' ); ?>
    		</label>
    	</p>
    
    	<p>
    		<label for="<?php echo $this->get_field_id("excerpt_length"); ?>">
    			<?php _e( 'Excerpt length (in words):' ); ?>
    		</label>
    		<input style="text-align: center;" type="text" id="<?php echo $this->get_field_id("excerpt_length"); ?>" name="<?php echo $this->get_field_name("excerpt_length"); ?>" value="<?php echo $instance["excerpt_length"]; ?>" size="3" />
    	</p>
    
    	<p>
    		<label for="<?php echo $this->get_field_id("num"); ?>">
    			<?php _e('Number of posts to show'); ?>:
    			<input style="text-align: center;" id="<?php echo $this->get_field_id("num"); ?>" name="<?php echo $this->get_field_name("num"); ?>" type="text" value="<?php echo absint($instance["num"]); ?>" size='3' />
    		</label>
    	</p>
    <?php
    
    }
    
    }
    
    add_action( 'widgets_init', create_function('', 'return register_widget("CategoryPosts");') );
    
    ?>

  2. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    Commercial themes aren't supported on these forums - and that's too much code to post here. Please ask the developer of the theme for help:

    http://themeforest.net/item/sancho-wp-theme/153860

  3. TravMoody
    Member
    Posted 10 months ago #

    Sorry. I messaged him, but who knows how long it will take him to write back. There's just something on the comment line 61. I wish someone would help...my site is destroyed :(

  4. Andrew
    Forum Moderator
    Posted 10 months ago #

    Alternatively use a theme we support: http://wordpress.org/themes/

Reply

You must log in to post.

About this Topic

Tags