• Hi
    can anyone help me
    I was trying to adapt my wp theme(purity)in the editor
    I was trying to add a line of text under my wiget area at the “youtube widget php file , I must have deleted some code cause my site has gone down.
    its coming up with this message on homepage

    Parse error: syntax error, unexpected ‘}’, expecting ‘,’ or ‘;’ in /home/focalpoi/public_html/wp-content/themes/purity/functions/widget-youtube.php on line 101

    here is the code for that widget-youtube.php file
    I think something must be missing, thanks

    <?php
    
    /*
    
    Plugin Name: YouTube
    Plugin URI: https://themeforest.net/user/Tauris/
    Description: Display a YouTube video.
    Version: 1.0
    Author: Tauris
    Author URI: https://themeforest.net/user/Tauris/
    
    */
    
    /* Add our function to the widgets_init hook. */
    add_action( 'widgets_init', 'pr_widget_youtube' );
    
    /* Function that registers our widget. */
    function pr_widget_youtube() {
    	register_widget( 'PR_Widget_Youtube' );
    }
    
    // Widget class.
    class PR_Widget_Youtube extends WP_Widget {
    
    	function PR_Widget_Youtube() {
    		/* Widget settings. */
    		$widget_ops = array( 'classname' => 'pr_widget_youtube', 'description' => 'Display a YouTube video.' );
    
    		/* Create the widget. */
    		$this->WP_Widget( 'pr_widget_youtube', '(C) YouTube', $widget_ops );
    	}
    
    	function widget( $args, $instance ) {
    		extract( $args );
    
    		/* User-selected settings. */
    		$title = apply_filters('widget_title', $instance['title'] );
    		$width = $instance['width'];
    		$height = $instance['height'];
    		$id = $instance['id'];
    
    		/* Before widget (defined by themes). */
    		echo $before_widget;
    
    		/* Title of widget (before and after defined by themes). */
    		if ( $title )
    			echo $before_title . $title . $after_title;
    
    		/* Display name from widget settings. */
    		?>        
    
            <iframe width="<?php echo $width ?>" height="<?php echo $height ?>" src="https://www.youtube.com/embed/<?php echo $id ?>" frameborder="0" allowfullscreen></iframe>
    
            <?php
    
    		/* After widget (defined by themes). */
    		echo $after_widget;
    	}
    
    	function update( $new_instance, $old_instance ) {
    		$instance = $old_instance;
    
    		/* Strip tags (if needed) and update the widget settings. */
    		$instance['title'] = strip_tags( $new_instance['title'] );
    		$instance['width'] = strip_tags( $new_instance['width'] );
    		$instance['height'] = strip_tags( $new_instance['height'] );
    		$instance['id'] = strip_tags( $new_instance['id'] );		
    
    		return $instance;
    	}
    
    	function form( $instance ) {
    
    		/* Set up some default widget settings. */
    		$defaults = array( 'title' => 'YouTube Video', 'width' => '198', 'height' => '150', 'id' => 'YW8p8JO2hQw');
    		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
    
        	<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' ); ?>" type="text" value="<?php echo $instance['title']; ?>" style="width:100%;" />
    		</p>  
    
            <p>
            <label for="<?php echo $this->get_field_id('width'); ?>">Width:</label>
    		<input id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo $instance['width']; ?>" size="3" />
            </p>         
    
            <p>
            <label for="<?php echo $this->get_field_id('height'); ?>">Height:</label>
    		<input id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo $instance['height']; ?>" size="3" />
            </p>
    
            <p>
            <label for="<?php echo $this->get_field_id('id'); ?>">Video ID:</label>
    		<input id="<?php echo $this->get_field_id('id'); ?>" name="<?php echo $this->get_field_name('id'); ?>" type="text" value="<?php echo $ins
    
    		}

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I was trying to add a line of text under my wiget area at the “youtube widget php file , I must have deleted some code cause my site has gone down.

    Rather than poking at that code (seriously, use pastebin.com instead, line numbers are a good thing) the simplest thing to do would be just to get a fresh copy of that Purity theme and use FTP or whatever file management tools your host has provided you with and restore the original file(s) that you’ve modified.

    For modifying any components of that theme, that’s a commercial theme and we don’t support those here. That doesn’t mean that you won’t get generic assistance but your best bet for support would be to contact that theme author directly.

    Part of what you paid was for support and there is no reason not to use that option.

    Thread Starter markwic

    (@markwic)

    thanks Jan ..contacting the “purity” support sounds like a good plan cause I dont really know what I,m doing

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    That’s all of us at one point! ?? But first get that original copy and overwrite your files in that theme directory. Step one is get your site back and running.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘website down .help needed’ is closed to new replies.