Adding link to Contact Info widget

Hello,

I would love to add aditional link or social icon to Contact-info widget. I have tried to add some code to contact-info.php, but it doesnt work. Cann you please help me. You can find the altered code bellow.

Thank you in advance

<?php

class Sydney_Contact_Info extends WP_Widget {

function sydney_contact_info() {
	$widget_ops = array('classname' =&gt; 'sydney_contact_info_widget', 'description' =&gt; __( 'Display your contact info', 'sydney') );
    parent::__construct(false, $name = __('Sydney: Contact info', 'sydney'), $widget_ops);
	$this-&gt;alt_option_name = 'sydney_contact_info';	
}

function form($instance) {

	$title    = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
	$address  = isset( $instance['address'] ) ? esc_html( $instance['address'] ) : '';
	$phone    = isset( $instance['phone'] ) ? esc_html( $instance['phone'] ) : '';
	$email    = isset( $instance['email'] ) ? esc_html( $instance['email'] ) : '';
$link     = isset( $instance['link '] ) ? esc_html( $instance['link '] ) : '';
?&gt;

&lt;p&gt;
&lt;label for="&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;"&gt;&lt;?php _e('Title', 'sydney'); ?&gt;&lt;/label&gt;
&lt;input class="widefat" id="&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name('title'); ?&gt;" type="text" value="&lt;?php echo $title; ?&gt;" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;label for="&lt;?php echo $this-&gt;get_field_id( 'address' ); ?&gt;"&gt;&lt;?php _e( 'Enter your address', 'sydney' ); ?&gt;&lt;/label&gt;
&lt;input class="widefat" id="&lt;?php echo $this-&gt;get_field_id( 'address' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'address' ); ?&gt;" type="text" value="&lt;?php echo $address; ?&gt;" size="3" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;label for="&lt;?php echo $this-&gt;get_field_id( 'phone' ); ?&gt;"&gt;&lt;?php _e( 'Enter your phone number', 'sydney' ); ?&gt;&lt;/label&gt;
&lt;input class="widefat" id="&lt;?php echo $this-&gt;get_field_id( 'phone' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'phone' ); ?&gt;" type="text" value="&lt;?php echo $phone; ?&gt;" size="3" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;label for="&lt;?php echo $this-&gt;get_field_id( 'email' ); ?&gt;"&gt;&lt;?php _e( 'Enter your email address', 'sydney' ); ?&gt;&lt;/label&gt;
&lt;input class="widefat" id="&lt;?php echo $this-&gt;get_field_id( 'email' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'email' ); ?&gt;" type="text" value="&lt;?php echo $email; ?&gt;" size="3" /&gt;&lt;/p&gt;	

<p><label for="<?php echo $this->get_field_id( 'link ’ ); ?>"><?php _e( ‘Enter your social url’, ‘sydney’ ); ?></label>
<input class=“widefat” id="<?php echo $this->get_field_id( 'link ’ ); ?>" name="<?php echo $this->get_field_name( 'link ’ ); ?>" type=“text” value="<?php echo $link ; ?>" size=“3” /></p>

&lt;?php
}

function update($new_instance, $old_instance) {
	$instance = $old_instance;
	$instance['title'] = strip_tags($new_instance['title']);
	$instance['address'] = strip_tags($new_instance['address']);
	$instance['phone'] = strip_tags($new_instance['phone']);
	$instance['email'] = sanitize_email($new_instance['email']);
$instance['link'] = strip_tags($new_instance['link']);

	$alloptions = wp_cache_get( 'alloptions', 'options' );
	if ( isset($alloptions['sydney_contact_info']) )
		delete_option('sydney_contact_info');		  
	  
	return $instance;
}
	
function widget($args, $instance) {
	$cache = array();
	if ( ! $this-&gt;is_preview() ) {
		$cache = wp_cache_get( 'sydney_contact_info', 'widget' );
	}

	if ( ! is_array( $cache ) ) {
		$cache = array();
	}

	if ( ! isset( $args['widget_id'] ) ) {
		$args['widget_id'] = $this-&gt;id;
	}

	if ( isset( $cache[ $args['widget_id'] ] ) ) {
		echo $cache[ $args['widget_id'] ];
		return;
	}

	ob_start();
	extract($args);

	$title 		= ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
	$title 		= apply_filters( 'widget_title', $title, $instance, $this-&gt;id_base );
	$address   	= isset( $instance['address'] ) ? esc_html( $instance['address'] ) : '';
	$phone   	= isset( $instance['phone'] ) ? esc_html( $instance['phone'] ) : '';
	$email   	= isset( $instance['email'] ) ? antispambot(esc_html( $instance['email'] )) : '';
$link    	= isset( $instance['link '] ) ? esc_html( $instance['link '] ) : '';

	echo $before_widget;
	
	if ( $title ) echo $before_title . $title . $after_title;
	
	if( ($address) ) {
		echo '&lt;div class="contact-address"&gt;';
		echo '&lt;span&gt;&lt;i class="fa fa-home"&gt;&lt;/i&gt;&lt;/span&gt;' . $address;
		echo '&lt;/div&gt;';
	}
	if( ($phone) ) {
		echo '&lt;div class="contact-phone"&gt;';
		echo '&lt;span&gt;&lt;i class="fa fa-phone"&gt;&lt;/i&gt;&lt;/span&gt;' . $phone;
		echo '&lt;/div&gt;';
	}
	if( ($email) ) {
		echo '&lt;div class="contact-email"&gt;';
		echo '&lt;span&gt;&lt;i class="fa fa-envelope"&gt;&lt;/i&gt;&lt;/span&gt;' . '<a href="mailto:' . $email . '">' . $email . '</a>';
		echo '&lt;/div&gt;';
	}	
if( ($link ) ) {
		echo '&lt;div class="contact-social"&gt;';
		echo '&lt;span&gt;&lt;i class="fa fa-facebook"&gt;&lt;/i&gt;&lt;/span&gt;' . '<a href="">' . $link . '</a>';
		echo '&lt;/div&gt;';
	}		

	echo $after_widget;


	if ( ! $this-&gt;is_preview() ) {
		$cache[ $args['widget_id'] ] = ob_get_flush();
		wp_cache_set( 'sydney_contact_info', $cache, 'widget' );
	} else {
		ob_end_flush();
	}
}

}

Hello there,

Try to use this https://gist.githubusercontent.com/kharissulistiyo/9515285866b392271778/raw/f26eabe527436e3a80f7902dcf97d83d880988ed/contact-info.php

Let me know how it goes.

Regards,
Kharis

Hello Kharis,

You are the man, you are awesome, thank you very much. It is working.

Can you please also help me with Pagination (it is mine second post and I already have a picture and texht in one div, so it is working fine, except the current bullet is not active).

Thank you
Steve

Hello there,

Would you please post your new question in a new topic as it doesn’t relate to the current one. I’d be very glad to assist you from there.

Regards,
Kharis

Hello Kharis,

it is in a new topic and at the moment you are assisting me with that also. So thank you very much.

BR
Steve