Hello peeps.
Im having an issues when activating my theme in wordpress. I got this error message:
"Parse error: syntax error, unexpected $end in C:\xampp\htdocs\xampp\wordpress\wp-content\themes\xit\functions.php on line 223".
Whats wrong, I totally dont understand. The script of the php is:
<?php if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>',
));
function content($num) {
$theContent = get_the_content();
$output = preg_replace('/<img[^>]+./','', $theContent);
$limit = $num+1;
$content = explode(' ', $output, $limit);
array_pop($content);
$content = implode(" ",$content)."...";
echo $content;
}
function post_is_in_descendant_category( $cats, $_post = null )
{
foreach ( (array) $cats as $cat ) {
// get_term_children() accepts integer ID only
$descendants = get_term_children( (int) $cat, 'category');
if ( $descendants && in_category( $descendants, $_post ) )
return true;
}
return false;
}
//custom comments
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author vcard">
<div class="comment-meta commentmetadata">
<?php echo get_avatar($comment,$size='32',$default='http://www.gravatar.com/avatar/61a58ec1c1fba116f8424035089b7c71?s=32&d=&r=G' ); ?>
<?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?> <br /><?php printf(__('<strong>%s</strong> says:'), get_comment_author_link()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?></div>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<em><?php _e('Your comment is awaiting moderation.') ?></em>
<br />
<?php endif; ?>
<div class="text"><?php comment_text() ?></div>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
<?php }
add_action('admin_menu', 'xit_theme_page');
function xit_theme_page ()
{
if ( count($_POST) > 0 && isset($_POST['xit_settings']) )
{
$options = array ( 'style','logo_img','logo_alt','logo_txt', 'logo_tagline', 'tagline_width', 'contact_email','ads', 'advertise_page', 'twitter_link', 'facebook_link', 'flickr', 'about_tit', 'about_txt', 'analytics');
foreach ( $options as $opt )
{
delete_option ( 'xit_'.$opt, $_POST[$opt] );
add_option ( 'xit_'.$opt, $_POST[$opt] );
}
}
add_theme_page(__('Xit Options'), __('Xit Options'), 'edit_themes', basename(__FILE__), 'xit_settings');
}
function xit_settings ()
{?>
<div class="wrap">
<h2>XIT Options Panel</h2>
<form method="post" action="">
<table class="form-table">
<!-- General settings -->
<tr>
<th colspan="2"><strong>General Settings</strong></th>
</tr>
<tr valign="top">
<th scope="row"><label for="style">Theme Color Scheme</label></th>
<td>
<select name="style" id="style">
<option value="pink.css" <?php if(get_option('xit_style') == 'pink.css'){?>selected="selected"<?php }?>>pink.css</option>
<option value="blue.css" <?php if(get_option('xit_style') == 'blue.css'){?>selected="selected"<?php }?>>blue.css</option>
<option value="orange.css" <?php if(get_option('xit_style') == 'orange.css'){?>selected="selected"<?php }?>>orange.css</option>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="logo_img">Logo image (full path to image)</label></th>
<td>
<input name="logo_img" type="text" id="logo_img" value="<?php echo get_option('xit_logo_img'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="logo_alt">Logo image ALT text</label></th>
<td>
<input name="logo_alt" type="text" id="logo_alt" value="<?php echo get_option('xit_logo_alt'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="logo_txt">Text logo</label></th>
<td>
<input name="logo_txt" type="text" id="logo_txt" value="<?php echo get_option('xit_logo_txt'); ?>" class="regular-text" />
<br /><em>Leave this empty if you entered an image as logo</em>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="logo_tagline">Logo Tag Line</label></th>
<td>
<input name="logo_tagline" type="text" id="logo_tagline" value="<?php echo get_option('xit_logo_tagline'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="tagline_width">Tag Line Box Width (px)</label><br /><em style="font-size:11px">Default width: 300px</em></th>
<td>
<input name="tagline_width" type="text" id="tagline_width" value="<?php echo get_option('xit_tagline_width'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="contact_email">Email Address for Contact Form</label></th>
<td>
<input name="contact_email" type="text" id="contact_email" value="<?php echo get_option('xit_contact_email'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="twitter_link">Twitter link</label></th>
<td>
<input name="twitter_link" type="text" id="twitter_link" value="<?php echo get_option('xit_twitter_link'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="facebook_link">Facebook link</label></th>
<td>
<input name="facebook_link" type="text" id="facebook_link" value="<?php echo get_option('xit_facebook_link'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="flickr">Flickr Photostream</label></th>
<td>
<select name="flickr" id="flickr">
<option value="yes" <?php if(get_option('xit_flickr') == 'yes'){?>selected="selected"<?php }?>>Yes</option>
<option value="no" <?php if(get_option('xit_flickr') == 'no'){?>selected="selected"<?php }?>>No</option>
</select>
<br /><em>Make sure you have FlickrRSS plugin activated if you choose to enable Flickr Photostream</em>
</td>
</tr>
<!-- Sidebar ABout Box-->
<tr>
<th colspan="2"><strong>Sidebar About Box</strong></th>
</tr>
<tr valign="top">
<th scope="row"><label for="about_tit">Title</label></th>
<td>
<input name="about_tit" type="text" id="about_tit" value="<?php echo get_option('xit_about_tit'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="about_txt">Text</label></th>
<td>
<textarea cols="60" rows="5" name="about_txt" type="text" id="about_txt" class="regular-text" /><?php echo get_option('xit_about_txt'); ?></textarea>
</td>
</tr>
<!-- Ads Box Settings -->
<tr>
<th colspan="2"><strong>Ads Box Settings</strong></th>
</tr>
<tr>
<th><label for="ads">Ads Section Enabled:</label></th>
<td>
<select name="ads" id="ads">
<option value="yes" <?php if(get_option('xit_ads') == 'yes'){?>selected="selected"<?php }?>>Yes</option>
<option value="no" <?php if(get_option('xit_ads') == 'no'){?>selected="selected"<?php }?>>No</option>
</select>
<br /><em>Make sure you have AdMinister plugin activated and have the position "Sidebar" created within the plugin.</em>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="advertise_page">Advertise Page</label></th>
<td>
<?php wp_dropdown_pages("name=advertise_page&show_option_none=".__('- Select -')."&selected=" .get_option('xit_advertise_page')); ?>
</td>
</tr>
<!-- Google Analytics -->
<tr>
<th><label for="ads">Google Analytics code:</label></th>
<td>
<textarea name="analytics" id="analytics" rows="7" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('xit_analytics')); ?></textarea>
</td>
</tr>
</table>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Save Changes" />
<input type="hidden" name="xit_settings" value="save" style="display:none;" />
</p>
</form>
</div>
<? }?>
<?php function get_first_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = "/images/default.jpg";
}
return $first_img;
} ?>
The last line is line 223.