Support » Plugin: Simple Social Icons » Using SSI with 'the_widget' in header

  • Resolved FireSamurai

    (@firesamurai)


    Hi,

    I’m on a MultiSite install (localhost) and am trying to incorporate the Simple Social Icons into the header without using a widget area. This way the social icons are on every subsite using the theme on the network.

    The code I’ve pasted below does add SSI to the header, but when SSI is also in any active widget area, the header displays the settings for the widget in the widget area instead of the ones I’ve put in the code. Any ideas on how to make the settings in the header function independently of the ones in any of the sidebars?

    //* Do custom header
    add_action( 'genesis_header', 'custom_do_header' );
    function custom_do_header() {
    
    	global $wp_registered_sidebars;
    
    	genesis_markup( array(
    		'html5'   => '<div %s>',
    		'xhtml'   => '<div id="title-area">',
    		'context' => 'title-area',
    	) );
    	do_action( 'genesis_site_title' );
    	do_action( 'genesis_site_description' );
    	echo '</div>';
    
    	genesis_markup( array(
    		'html5'   => '<aside %s>',
    		'xhtml'   => '<div class="header-social">',
    		'context' => 'header-social-area',
    	) );
    
    	do_action( 'custom_social' );
    
    	genesis_markup( array(
    		'html5' => '</aside>',
    		'xhtml' => '</div>',
    	) );
    
    }

    And the supporting function for ‘custom social’:

    add_action( 'custom_social', 'custom_social_content' );
    function custom_social_content() {
    
    	if ( !dynamic_sidebar() ) :
    
    		the_widget( 'Simple_Social_Icons_Widget', array(
    			'new_window'             => 1,
    			'size'                   => 48,
    			'border_radius'          => 48,
    			'icon_color'             => '#ffffff',
    			'icon_color_hover'       => '#ffffff',
    			'background_color'       => '#333333',
    			'background_color_hover' => '#003566',
    			'alignment'              => 'alignright',
    			'facebook'		 => 'https://www.facebook.com/myfacebook',
    			'twitter' 		 => 'http://twitter.com/mytwitter',
    			'youtube' 		 => 'http://www.youtube.com/user/myyoutube'
    		) );
    
    	endif;
    
    }

    Much thanks!

    https://wordpress.org/plugins/simple-social-icons/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ron Rennick

    (@wpmuguru)

    Any ideas on how to make the settings in the header function independently of the ones in any of the sidebars?

    You need to add some CSS to your theme(s) that target the widget in the header.

    Thread Starter FireSamurai

    (@firesamurai)

    Hi Ron, thanks for replying. I figured that’s what I’d end up having to do, but was hoping there was some sort of conditional statement I was unaware of that would take care of it via functions.php.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using SSI with 'the_widget' in header’ is closed to new replies.