Custom plugin not allowing access to wp-admin
-
I’m making my first Wodrpress widget. Something simple that lets you put in social link buttons into a sidebar. I followed tutorials that told me to wrap the widget in a plugin, and I got it working fine, however when I tried to log out or log in again I got just a white screen. I removed the folder from the plugin directory and I could access wp-admin fine. if I’m already logged in and make the plugin i made active, everything works fine. Its just the wp-admin screen is totally white when the plugin is activated.
Here is the plugin code
class social_widget extends WP_Widget { public function __construct(){ $widget_ops = array('classname' => 'social_widget', 'description' => 'Displays an My widget!' ); $this->WP_Widget('social_widget', 'Social Buttons', $widget_ops); } function widget($args, $instance) { extract($args, EXTR_SKIP); $fb = $instance['facebookk']; $link = $instance['linkedd']; $twit = $instance['twitterr']; echo $before_widget; if ( $fb ) : ?> <a href="<?php echo $fb; ?>" target="_blank"><img id="contlink" src="<?php bloginfo('template_directory'); ?>/images/fb-wht.png"></a> <?php endif; if ( $link ) : ?> <a href="<?php echo $link; ?>" target="_blank"><img id="contlink" src="<?php bloginfo('template_directory'); ?>/images/linkeded-wht.png"></a> <?php endif; if ( $twit ) : ?> <a href="<?php echo $twit; ?>" target="_blank"><img id="contlink" src="<?php bloginfo('template_directory'); ?>/images/twitter-wht.png"></a> <?php endif; echo $after_widget; } public function form($instance){ $instance = wp_parse_args( (array) $instance, array( 'facebookk' => 'your mom') ); ?> <p> <label for="<?php echo $this->get_field_id('facebookk'); ?>"><?php _e('Facebookk', 'social_widget'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('facebookk'); ?>" name="<?php echo $this->get_field_name('facebookk'); ?>" type="text" value="<?php echo $instance['facebookk']; ?>" /> </p> <p> <label for="<?php echo $this->get_field_id('linkedd'); ?>"><?php _e('Linkeddin', 'social_widget'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('linkedd'); ?>" name="<?php echo $this->get_field_name('linkedd'); ?>" type="text" value="<?php echo $instance['linkedd']; ?>" /> </p> <p> <label for="<?php echo $this->get_field_id('twitterr'); ?>"><?php _e('Twitterr', 'social_widget'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('twitterr'); ?>" name="<?php echo $this->get_field_name('twitterr'); ?>" type="text" value="<?php echo $instance['twitterr']; ?>" /> </p> <?php } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['facebookk'] = $new_instance['facebookk']; $instance['linkedd'] = $new_instance['linkedd']; $instance['twitterr'] = $new_instance['twitterr']; return $instance; } } add_action( 'widgets_init', create_function('', 'return register_widget("social_widget");') );
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Custom plugin not allowing access to wp-admin’ is closed to new replies.