WordPress.org

Support

Support » Plugins and Hacks » New plugin fatal error

New plugin fatal error

  • Hello there,

    I’m new in making a widget for WP. But everything went well until I wanted to activate the plugin. I’m getting a fatal error at the <h3 style="padding-left:14px;background:#ebebeb;"> line Here is my code:

    <?php
    /*
    Plugin Name: Twitter Search
    Description: Search on Twitter
    Author: Nick MDC
    Version: 1
    Author URI:
    */
    
      // Initialization function
      function WP_Widget_searchtwitter_init()
      {
        new WP_Widget_searchtwitter();
      }
    
      // Your Class
      class WP_Widget_searchtwitter extends WP_Widget
      {
        // Constructor
    	function WP_Widget_searchtwitter()
    	{
    	  $widget_ops = array('description' => __('Search on Twitter', 'searchtwitter'));
    	  $this->WP_Widget('searchtwitter', __('Searchtwitter'), $widget_ops);
    	}
    
    	// Display Widget
    	function widget($args, $instance) {
    		extract($args);
    		$title = attribute_escape($instance['title']);
    		echo $before_widget.$before_title.$title.$after_title;
    		searchtwitter();
    		echo $after_widget;
    	}
    
    	// When Widget Control Form Is Posted
    	function update($new_instance, $old_instance)
    	{
    		if (!isset($new_instance['submit']))
    		{
    			return false;
    		}
    		$instance = $old_instance;
    		$instance['title'] = strip_tags($new_instance['title']);
    		return $instance;
    	}
    
        /* Your custom code starts here */
    	/* ---------------------------- */
    
    	/* Your Function */
    	function searchtwitter()
    	{
    
    	  /* Your Code ----------------- */ 
    
    	  <h3 style="padding-left:14px;background:#ebebeb;">
    
            <a name="widget"></a>
    
            <?php
    
    			if(isset($_POST['sw-search-terms'])){
    				$_SESSION['search_terms'] = $_POST['sw-search-terms'];
    			} else {
    				if(isset($_SESSION['search_terms'])){
    
    				} else {
    					$_SESSION['search_terms'] = 'svbinteractive';
    				}
    			}
    
    		?>
    
    		<form action="<?php echo $PHP_SELF; ?>#widget" method="post">
            <p valign="middle">
    		  <input type="text" onclick="this.value='';" style="margin-bottom:6px;" class="formclass" size="27" value="<?php echo $_SESSION['search_terms']; ?>" name="sw-search-terms" id="sw-search-terms">
    
              <input type="image" style="margin-bottom:6px;margin-top:3px;" class="labelleft" src="./wp-content/themes/svb/images/zoeken.png" value="" />
    		</p>
    		</form>
    
            </h3>
            <script src="http://widgets.twimg.com/j/2/widget.js"></script>
    <script>
    new TWTR.Widget({
      version: 2,
      type: 'search',
      search: document.getElementById('sw-search-terms').value,
      interval: 6000,
      title: 'Wat hebben de mensen te zeggen over:',
      subject: document.getElementById('sw-search-terms').value,
      width: 270,
      height: 300,
      theme: {
        shell: {
          background: '#8ec1da',
          color: '#ffffff'
        },
        tweets: {
          background: '#ffffff',
          color: '#444444',
          links: '#1985b5'
        }
      },
      features: {
        scrollbar: false,
        loop: true,
        live: true,
        hashtags: true,
        timestamp: true,
        avatars: true,
        behavior: 'default'
      }
    }).render().start();
    </script>
    
    	  /* End of Your Code ---------- */
    
    	}
      }
    
      add_action('widgets_init', 'WP_Widget_searchtwitter_init');
    
    ?>

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • After searching on the internet I think it will be a lot of work to get this working. The solution for now is hard code it in the sidebar.

Viewing 1 replies (of 1 total)
  • The topic ‘New plugin fatal error’ is closed to new replies.
Skip to toolbar