Title: Getting a parse error on MaxMag theme
Last modified: August 21, 2016

---

# Getting a parse error on MaxMag theme

 *  [Nickka](https://wordpress.org/support/users/nickka/)
 * (@nickka)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/)
 * _[Use a more descriptive title in future]_
 * I am using the MaxMag theme and have the Tow-Column Widget installed and active.
   I tried to edit the code in the editor and messed up. Now the page is broken.
   I get the following error:
 * Parse error: syntax error, unexpected T_ENDWHILE in /home/dparadis/public_html/
   wp-content/themes/maxmag/widgets/widget-recent.php on line 64
 * currently, my code looks like:
 *     ```
       <?php
       /**
        * Plugin Name: Homepage Recent Widget
        */
   
       add_action( 'widgets_init', 'maxmag_recent_load_widgets' );
   
       function maxmag_recent_load_widgets() {
       	register_widget( 'maxmag_recent_widget' );
       }
   
       class maxmag_recent_widget extends WP_Widget {
   
       	/**
       	 * Widget setup.
       	 */
       	function maxmag_recent_widget() {
       		/* Widget settings. */
       		$widget_ops = array( 'classname' => 'maxmag_recent_widget', 'description' => __('A widget that displays a list of posts from a category of your choice.', 'maxmag_recent_widget') );
   
       		/* Widget control settings. */
       		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'maxmag_recent_widget' );
   
       		/* Create the widget. */
       		$this->WP_Widget( 'maxmag_recent_widget', __('Max Mag: Recent Posts Widget', 'maxmag_recent_widget'), $widget_ops, $control_ops );
       	}
   
       	/**
       	 * How to display the widget on the screen.
       	 */
       	function widget( $args, $instance ) {
       		extract( $args );
   
       		/* Our variables from the widget settings. */
       		$title = apply_filters('widget_title', $instance['title'] );
       		$number = $instance['number'];
       		$categories = $instance['categories'];
   
       		/* Before widget (defined by themes). */
       		echo $before_widget;
   
       		/* Display the widget title if one was input (before and after defined by themes). */
       		if ( $title )
       			echo $before_title . $title . $after_title;
       		?>
   
       			<ul class="middle-widget">
       				<?php $recent = new WP_Query(array( 'cat' => $categories, 'showposts' => $number )); while($recent->have_posts()) : $recent->the_post();?>
   
       <li>
       					<a>" rel="bookmark" class="main-headline"><?php the_title(); ?></a>
       					<p><?php echo excerpt(11); ?></p>
       					<div class="headlines-info">
       						<ul class="headlines-info">
   
       					</div><!--headlines-info-->
       				</li>
       			<?php endwhile; ?>
   
       		<?php 
   
       		/* After widget (defined by themes). */
       		echo $after_widget;
       	}
   
       	/**
       	 * Update the widget settings.
       	 */
       	function update( $new_instance, $old_instance ) {
       		$instance = $old_instance;
   
       		/* Strip tags for title and name to remove HTML (important for text inputs). */
       		$instance['title'] = strip_tags( $new_instance['title'] );
       		$instance['number'] = strip_tags( $new_instance['number'] );
       		$instance['categories'] = $new_instance['categories'];
   
       		return $instance;
       	}
   
       	function form( $instance ) {
   
       		/* Set up some default widget settings. */
       		$defaults = array( 'title' => __('Latest News'), 'number' => 7);
       		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
   
       		<!-- Widget Title: Text Input -->
       		<p>
       			<label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>
       			<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:90%;" />
       		</p>
   
       		<!-- Number of posts -->
       		<p>
       			<label for="<?php echo $this->get_field_id( 'number' ); ?>">Number of posts to show:</label>
       			<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" value="<?php echo $instance['number']; ?>" size="3" />
       		</p>
   
       		<!-- Category -->
       		<p>
       			<label for="<?php echo $this->get_field_id('categories'); ?>">Select Category:</label>
       			<select id="<?php echo $this->get_field_id('categories'); ?>" name="<?php echo $this->get_field_name('categories'); ?>" style="width:100%;">
       				<option value='all' <?php if ('all' == $instance['categories']) echo 'selected="selected"'; ?>>All Categories</option>
       				<?php $categories = get_categories('hide_empty=0&depth=1&type=post'); ?>
       				<?php foreach($categories as $category) { ?>
       				<option value='<?php echo $category->term_id; ?>' <?php if ($category->term_id == $instance['categories']) echo 'selected="selected"'; ?>><?php echo $category->cat_name; ?></option>
       				<?php } ?>
       			</select>
       		</p>
   
       	<?php
       	}
       }
   
       ?>
       ```
   
 * _[Please wrap your code in backticks in the future]_
 * Can someone help me fix this???????????
 * Please help!
 * Thanks
 * Nick

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [David Choi](https://wordpress.org/support/users/wpthemes777/)
 * (@wpthemes777)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680872)
 * The code you’ve provided is fine, doesn’t generate any PHP error:
 * [http://www.piliapp.com/php-syntax-check/](http://www.piliapp.com/php-syntax-check/)
 *  Thread Starter [Nickka](https://wordpress.org/support/users/nickka/)
 * (@nickka)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680895)
 * How come i keep getting the error then?
 * I a newbie, thought i was getting the hang of this….and then boom!
 * Now my site is down!
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680898)
 * Which file is that code from?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680900)
 * Where did you get your theme from?
 *  Thread Starter [Nickka](https://wordpress.org/support/users/nickka/)
 * (@nickka)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680901)
 * I think it came from WordPress.
 * My IT guy’s caught up with a lot of person issues. He usally does this. But i
   thought i’d help him out…but i made things worse
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680903)
 * Please identify it on WordPress.org [http://wordpress.org/extend/themes/](http://wordpress.org/extend/themes/)
   so we can take a look at the theme’s original files and see what you’ve done 
   different.
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680906)
 * Using FTP delete that theme and then reinstall it –
 * [http://codex.wordpress.org/Login_Trouble#Deactivate_Theme](http://codex.wordpress.org/Login_Trouble#Deactivate_Theme)
 *  Thread Starter [Nickka](https://wordpress.org/support/users/nickka/)
 * (@nickka)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680909)
 * does this help
 * maxmag/widgets/widget-recent.php on line 64
 * Max Magazine
    Authored by Sami
 * is that what you mean
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680911)
 * See what I posted above – if you don’t want to reinstall the entire theme, download
   a new copy to your local computer – then replace just that file from the new 
   download – again, using FTP or another file manager program your host uses.
 *  Thread Starter [Nickka](https://wordpress.org/support/users/nickka/)
 * (@nickka)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680927)
 * I’m hoping i can just edit the script in my editor for:
 * Max Mag Theme: widget-recent.php (widgets/widget-recent.php)
 * i think it’s only a simple oversight…at least I hope.
 * I can just revise the script in the editor to fix the problem, right?
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680933)
 * No idea – you can try it – download the theme and compare what you have to the
   one that’s there. Or just copy/paste the new one into that file. May or may not
   work.
 *  Thread Starter [Nickka](https://wordpress.org/support/users/nickka/)
 * (@nickka)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680944)
 * I’m all set now.
 * Site is back up
 * I learned a lesson I won’t soon forget.
 * Thanks to everyone for all your help
 *  [David Choi](https://wordpress.org/support/users/wpthemes777/)
 * (@wpthemes777)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680954)
 * Glad it’s solved 🙂

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Getting a parse error on MaxMag theme’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 13 replies
 * 4 participants
 * Last reply from: [David Choi](https://wordpress.org/support/users/wpthemes777/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/help-382/#post-3680954)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
