| Server IP : 216.238.66.20 / Your IP : 216.73.216.158 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/sweetheart.mx/htdocs/wp-content/themes/rosemary/inc/widgets/ |
Upload File : |
<?php
/**
* Plugin Name: Social Widget
*/
add_action( 'widgets_init', 'solopine_social_load_widget' );
function solopine_social_load_widget() {
register_widget( 'solopine_social_widget' );
}
class solopine_social_widget extends WP_Widget {
/**
* Widget setup.
*/
function __construct() {
/* Widget settings. */
$widget_ops = array( 'classname' => 'solopine_social_widget', 'description' => __('A widget that displays your social icons', 'solopine_social_widget') );
/* Widget control settings. */
$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'solopine_social_widget' );
/* Create the widget. */
$this->WP_Widget( 'solopine_social_widget', __('Rosemary: Social Icons', 'solopine_social_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'] );
$facebook = $instance['facebook'];
$twitter = $instance['twitter'];
$googleplus = $instance['googleplus'];
$instagram = $instance['instagram'];
$bloglovin = $instance['bloglovin'];
$youtube = $instance['youtube'];
$tumblr = $instance['tumblr'];
$pinterest = $instance['pinterest'];
$dribbble = $instance['dribbble'];
$soundcloud = $instance['soundcloud'];
$vimeo = $instance['vimeo'];
$rss = $instance['rss'];
/* 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;
?>
<div class="social-widget">
<?php if($facebook) : ?><a href="<?php echo get_theme_mod('sp_facebook'); ?>" target="_blank"><i class="fa fa-facebook"></i></a><?php endif; ?>
<?php if($twitter) : ?><a href="<?php echo get_theme_mod('sp_twitter'); ?>" target="_blank"><i class="fa fa-twitter"></i></a><?php endif; ?>
<?php if($instagram) : ?><a href="<?php echo get_theme_mod('sp_instagram'); ?>" target="_blank"><i class="fa fa-instagram"></i></a><?php endif; ?>
<?php if($pinterest) : ?><a href="<?php echo get_theme_mod('sp_pinterest'); ?>" target="_blank"><i class="fa fa-pinterest"></i></a><?php endif; ?>
<?php if($bloglovin) : ?><a href="<?php echo get_theme_mod('sp_bloglovin'); ?>" target="_blank"><i class="fa fa-heart"></i></a><?php endif; ?>
<?php if($googleplus) : ?><a href="<?php echo get_theme_mod('sp_google'); ?>" target="_blank"><i class="fa fa-google-plus"></i></a><?php endif; ?>
<?php if($tumblr) : ?><a href="<?php echo get_theme_mod('sp_tumblr'); ?>" target="_blank"><i class="fa fa-tumblr"></i></a><?php endif; ?>
<?php if($youtube) : ?><a href="<?php echo get_theme_mod('sp_youtube'); ?>" target="_blank"><i class="fa fa-youtube-play"></i></a><?php endif; ?>
<?php if($dribbble) : ?><a href="<?php echo get_theme_mod('sp_dribbble'); ?>" target="_blank"><i class="fa fa-dribbble"></i></a><?php endif; ?>
<?php if($soundcloud) : ?><a href="<?php echo get_theme_mod('sp_soundcloud'); ?>" target="_blank"><i class="fa fa-soundcloud"></i></a><?php endif; ?>
<?php if($vimeo) : ?><a href="<?php echo get_theme_mod('sp_vimeo'); ?>" target="_blank"><i class="fa fa-vimeo-square"></i></a><?php endif; ?>
<?php if($rss) : ?><a href="<?php echo get_theme_mod('sp_rss'); ?>" target="_blank"><i class="fa fa-rss"></i></a><?php endif; ?>
</div>
<?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['facebook'] = strip_tags( $new_instance['facebook'] );
$instance['twitter'] = strip_tags( $new_instance['twitter'] );
$instance['googleplus'] = strip_tags( $new_instance['googleplus'] );
$instance['instagram'] = strip_tags( $new_instance['instagram'] );
$instance['bloglovin'] = strip_tags( $new_instance['bloglovin'] );
$instance['youtube'] = strip_tags( $new_instance['youtube'] );
$instance['tumblr'] = strip_tags( $new_instance['tumblr'] );
$instance['pinterest'] = strip_tags( $new_instance['pinterest'] );
$instance['dribbble'] = strip_tags( $new_instance['dribbble'] );
$instance['soundcloud'] = strip_tags( $new_instance['soundcloud'] );
$instance['vimeo'] = strip_tags( $new_instance['vimeo'] );
$instance['rss'] = strip_tags( $new_instance['rss'] );
return $instance;
}
function form( $instance ) {
/* Set up some default widget settings. */
$defaults = array( 'title' => 'Subscribe & Follow', 'facebook' => 'on', 'twitter' => 'on', 'instagram' => 'on', );
$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>
<p>Note: Set your social links in the Customizer</p>
<p>
<label for="<?php echo $this->get_field_id( 'facebook' ); ?>">Show Facebook:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'facebook' ); ?>" name="<?php echo $this->get_field_name( 'facebook' ); ?>" <?php checked( (bool) $instance['facebook'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'twitter' ); ?>">Show Twitter:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'twitter' ); ?>" name="<?php echo $this->get_field_name( 'twitter' ); ?>" <?php checked( (bool) $instance['twitter'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'instagram' ); ?>">Show Instagram:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'instagram' ); ?>" name="<?php echo $this->get_field_name( 'instagram' ); ?>" <?php checked( (bool) $instance['instagram'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'pinterest' ); ?>">Show Pinterest:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'pinterest' ); ?>" name="<?php echo $this->get_field_name( 'pinterest' ); ?>" <?php checked( (bool) $instance['pinterest'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'bloglovin' ); ?>">Show Bloglovin:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'bloglovin' ); ?>" name="<?php echo $this->get_field_name( 'bloglovin' ); ?>" <?php checked( (bool) $instance['bloglovin'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'googleplus' ); ?>">Show Google Plus:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'googleplus' ); ?>" name="<?php echo $this->get_field_name( 'googleplus' ); ?>" <?php checked( (bool) $instance['googleplus'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'tumblr' ); ?>">Show Tumblr:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'tumblr' ); ?>" name="<?php echo $this->get_field_name( 'tumblr' ); ?>" <?php checked( (bool) $instance['tumblr'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'youtube' ); ?>">Show Youtube:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'youtube' ); ?>" name="<?php echo $this->get_field_name( 'youtube' ); ?>" <?php checked( (bool) $instance['youtube'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'dribbble' ); ?>">Show Dribbble:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'dribbble' ); ?>" name="<?php echo $this->get_field_name( 'dribbble' ); ?>" <?php checked( (bool) $instance['dribbble'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'soundcloud' ); ?>">Show Soundcloud:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'soundcloud' ); ?>" name="<?php echo $this->get_field_name( 'soundcloud' ); ?>" <?php checked( (bool) $instance['soundcloud'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'vimeo' ); ?>">Show Vimeo:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'vimeo' ); ?>" name="<?php echo $this->get_field_name( 'vimeo' ); ?>" <?php checked( (bool) $instance['vimeo'], true ); ?> />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'rss' ); ?>">Show RSS:</label>
<input type="checkbox" id="<?php echo $this->get_field_id( 'rss' ); ?>" name="<?php echo $this->get_field_name( 'rss' ); ?>" <?php checked( (bool) $instance['rss'], true ); ?> />
</p>
<?php
}
}
?>