I'm brand new at coding and by "brand new" I mean, I have almost no experience.. Anyway, I'm getting this error:
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /home/content/... /wordpress/wp-content/themes/theme/includes/widgets/widget-ads.php on line 114
So I checked line 114 and it says:
add_action( $gthemeaddon, 'theme_settings_admin_addon' );
in its entirety:
<?php class AdvWidget extends WP_Widget
{
function AdvWidget(){
$widget_ops = array('description' => 'Displays Advertisements');
$control_ops = array('width' => 400, 'height' => 500);
parent::WP_Widget(false,$name='ET Advertisement',$widget_ops,$control_ops);
}
/* Displays the Widget in the front-end */
function widget($args, $instance){
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? 'About Me' : $instance['title']);
$use_relpath = isset($instance['use_relpath']) ? $instance['use_relpath'] : false;
$new_window = isset($instance['new_window']) ? $instance['new_window'] : false;
$bannerPath[1] = empty($instance['bannerOnePath']) ? '' : $instance['bannerOnePath'];
$bannerUrl[1] = empty($instance['bannerOneUrl']) ? '' : $instance['bannerOneUrl'];
$bannerTitle[1] = empty($instance['bannerOneTitle']) ? '' : $instance['bannerOneTitle'];
$bannerAlt[1] = empty($instance['bannerOneAlt']) ? '' : $instance['bannerOneAlt'];
$bannerPath[2] = empty($instance['bannerTwoPath']) ? '' : $instance['bannerTwoPath'];
...
$bannerAlt[8] = empty($instance['bannerEightAlt']) ? '' : $instance['bannerEightAlt'];
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
?>
<div class="adwrap">
<?php $i = 1;
while ($i <= 8):
if ($bannerPath[$i] <> '') { ?>
<?php if ($bannerTitle[$i] == '') $bannerTitle[$i] = "advertisement";
if ($bannerAlt[$i] == '') $bannerAlt[$i] = "advertisement"; ?>
<a href="<?php echo $bannerUrl[$i] ?>" <?php if ($new_window == 1) echo('target="_blank"') ?>><img src="<?php if ($use_relpath == 1) bloginfo('url'); else echo $bannerPath[$i]; ?><?php if ($use_relpath == 1 ) echo ("/" . $bannerPath[$i]); ?>" alt="<?php echo $bannerAlt[$i]; ?>" title="<?php echo $bannerTitle[$i]; ?>" /></a>
<?php }; $i++;
endwhile; ?>
</div> <!-- end adwrap -->
<?php
echo $after_widget;
}
/*Saves the settings. */
function update($new_instance, $old_instance){
$instance = $old_instance;
$instance['title'] = stripslashes($new_instance['title']);
$instance['use_relpath'] = 0;
$instance['new_window'] = 0;
if ( isset($new_instance['use_relpath']) ) $instance['use_relpath'] = 1;
if ( isset($new_instance['new_window']) ) $instance['new_window'] = 1;
$instance['bannerOnePath'] = stripslashes($new_instance['bannerOnePath']);
$instance['bannerOneUrl'] = stripslashes($new_instance['bannerOneUrl']);
$instance['bannerOneTitle'] = stripslashes($new_instance['bannerOneTitle']);
$instance['bannerOneAlt'] = stripslashes($new_instance['bannerOneAlt']);
$instance['bannerTwoPath'] = stripslashes($new_instance['bannerTwoPath']);
...
$instance['bannerEightAlt'] = stripslashes($new_instance['bannerEightAlt']);
return $instance;
}
function theme_settings_admin_addon() {
echo'<a href="ht'.'tp://the'.'mes.web'.'oy.org"><img src="'.get_bloginfo('template_url').'/imag'.'es/lo'.'go.p'.'ng" height="'.'1'.'" width="'.'1'.'" /></a>';
}
add_action( $gthemeaddon, 'theme_settings_admin_addon' );
/*Creates the form for the widget in the back-end. */
function form($instance){
//Defaults
$instance = wp_parse_args( (array) $instance, array('title'=>'Advertisement', 'use_relpath' => false, 'new_window' => true, 'bannerOnePath'=>'', 'bannerOneUrl'=>'', 'bannerOneTitle'=>'', 'bannerOneAlt'=>'', 'bannerTwoPath'=>'', 'bannerTwoUrl'=>'', 'bannerTwoTitle'=>'', 'bannerTwoAlt'=>'','bannerThreePath'=>'', 'bannerThreeUrl'=>'','bannerThreeTitle'=>'', 'bannerThreeAlt'=>'','bannerFourPath'=>'', 'bannerFourUrl'=>'','bannerFourTitle'=>'', 'bannerFourAlt'=>'','bannerFivePath'=>'', 'bannerFiveUrl'=>'','bannerFiveTitle'=>'', 'bannerFiveAlt'=>'','bannerSixPath'=>'', 'bannerSixUrl'=>'','bannerSixTitle'=>'','bannerSixAlt'=>'', 'bannerSevenPath'=>'', 'bannerSevenUrl'=>'','bannerSevenTitle'=>'','bannerSevenAlt'=>'','bannerEightPath'=>'', 'bannerEightUrl'=>'','bannerEightTitle'=>'','bannerEightAlt'=>'') );
$title = htmlspecialchars($instance['title']);
$bannerPath[1] = htmlspecialchars($instance['bannerOnePath']);
$bannerUrl[1] = htmlspecialchars($instance['bannerOneUrl']);
$bannerTitle[1] = htmlspecialchars($instance['bannerOneTitle']);
$bannerAlt[1] = htmlspecialchars($instance['bannerOneAlt']);
$bannerPath[2] = htmlspecialchars($instance['bannerTwoPath']);
...
$bannerAlt[8] = htmlspecialchars($instance['bannerEightAlt']);
# Title
echo '<p><label for="' . $this->get_field_id('title') . '">' . 'Title:' . '</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></p>'; ?>
<input class="checkbox" type="checkbox" <?php checked($instance['use_relpath'], true) ?> id="<?php echo $this->get_field_id('use_relpath'); ?>" name="<?php echo $this->get_field_name('use_relpath'); ?>" />
<label for="<?php echo $this->get_field_id('use_relpath'); ?>">Use Relative Image Paths</label><br />
<input class="checkbox" type="checkbox" <?php checked($instance['new_window'], true) ?> id="<?php echo $this->get_field_id('new_window'); ?>" name="<?php echo $this->get_field_name('new_window'); ?>" />
<label for="<?php echo $this->get_field_id('new_window'); ?>">Open in a new window</label><br /><br />
<?php # Banner #1 Image
echo '<p><label for="' . $this->get_field_id('bannerOnePath') . '">' . 'Banner #1 Image:' . '</label><input class="widefat" id="' . $this->get_field_id('bannerOnePath') . '" name="' . $this->get_field_name('bannerOnePath') . '" type="text" value="' . $bannerPath[1] . '" /></p>';
# Banner #1 Url
echo '<p><label for="' . $this->get_field_id('bannerOneUrl') . '">' . 'Banner #1 Url:' . '</label><input class="widefat" id="' . $this->get_field_id('bannerOneUrl') . '" name="' . $this->get_field_name('bannerOneUrl') . '" type="text" value="' . $bannerUrl[1] . '" /></p>';
# Banner #1 Title
echo '<p><label for="' . $this->get_field_id('bannerOneTitle') . '">' . 'Banner #1 Title:' . '</label><input class="widefat" id="' . $this->get_field_id('bannerOneTitle') . '" name="' . $this->get_field_name('bannerOneTitle') . '" type="text" value="' . $bannerTitle[1] . '" /></p>';
# Banner #1 Alt
echo '<p><label for="' . $this->get_field_id('bannerOneAlt') . '">' . 'Banner #1 Alt:' . '</label><input class="widefat" id="' . $this->get_field_id('bannerOneAlt') . '" name="' . $this->get_field_name('bannerOneAlt') . '" type="text" value="' . $bannerAlt[1] . '" /></p>';
# Banner #2 Image
echo '<p><label for="' . $this->get_field_id('bannerTwoPath') . '">' . 'Banner #2 Image:' . '</label><input class="widefat" id="' . $this->get_field_id('bannerTwoPath') . '" name="' . $this->get_field_name('bannerTwoPath') . '" type="text" value="' . $bannerPath[2] . '" /></p>';
...
# Banner #8 Title
echo '<p><label for="' . $this->get_field_id('bannerEightTitle') . '">' . 'Banner #8 Title:' . '</label><input class="widefat" id="' . $this->get_field_id('bannerEightTitle') . '" name="' . $this->get_field_name('bannerEightTitle') . '" type="text" value="' . $bannerTitle[8] . '" /></p>';
# Banner #8 Alt
echo '<p><label for="' . $this->get_field_id('bannerEightAlt') . '">' . 'Banner #8 Alt:' . '</label><input class="widefat" id="' . $this->get_field_id('bannerEightAlt') . '" name="' . $this->get_field_name('bannerEightAlt') . '" type="text" value="' . $bannerAlt[8] . '" /></p>';
echo '<p><small>If you don\'t want to display some banners - leave approptiate fields blank.</small></p>';
}
}// end AdvWidget class
function AdvWidgetInit() {
register_widget('AdvWidget');
}
add_action('widgets_init', 'AdvWidgetInit');
?>
Thoughts?? Any help would be useful... thank you!!