NX WP Theme

Social Sharing Widget


About the widget

The Social Sharing Widget is usually used in the single page, in order to share the content.  It contains the following ways of sharing

  • Facebook
  • X
  • Print
  • Linkedin
  • Viber
  • E-mail
  • Whatsapp
  • Pinterest

Enable Widget

In order for the Social Sharing Widget widget to appear in the Widgets list  (Appearance -> Widgets) we need to enable it.

Widget Override

If you need to override the widget in the child theme, you must inherit the parent widget of the parent theme. Inside your child theme folder (usually in wp-content/themes/nx-theme-child), create a relevant folder structure as the parent theme wp-content/themes/nx-theme-child/widgets. Create a php file that inherits the parent widget as follows

class Social_Share_Widget_Child extends Social_Share_Widget
{
 ... widget stuff
}

Next step is to replace the parent widget and yo can do so as follows

function replace_parent_widget() {
    if ( class_exists('Social_Share_Widget') ) {
        unregister_widget('social_share_widget');
        require_once get_theme_file_path('/widgets/Social_Share_Widget_Child.php');
        register_widget('Social_Share_Widget_Child');
    }
}

add_action('widgets_init', 'replace_parent_widget', 15);