WP Customizer - Section Settings to Front End

Not sure how to phrase the question exactly but I am working on adding custom items to the theme customizer in Wordpress.

I have added a Section for the user to add Social Media Accounts and have a linked image show if content exists.  Here is my code in my functions file.

// add Social Media Selction section
	$wp_customize->add_section( 'parallaxone_social_options_section' , array(
		'title'      => __( 'Social Media Options', 'parallaxone' ),
		'priority'   => 150,
	) );	
	// add setting to select facebook
	$wp_customize->add_setting( 'parallaxone_facebook_select', array( 
		'fbdefault' 	=> ' '
	) );
		$wp_customize->add_control( 'parallaxone_facebook_select', array(
		'label'     => __( 'Facebook', 'parallaxone' ),
		'section'   => 'parallaxone_social_options_section',
		'priority'  => 10,
		'type'      => 'text'
	) );
	
	// add setting to select twitter
	$wp_customize->add_setting( 'parallaxone_twitter_select', array( 
		'twdefault' 	=> ' '
	) );
		$wp_customize->add_control( 'parallaxone_twitter_select', array(
		'label'     => __( 'Twitter', 'parallaxone' ),
		'section'   => 'parallaxone_social_options_section',
		'priority'  => 20,
		'type'      => 'text'
	) );

Open in new window


And here is my front end code on the home page;

<?php $fbdef = get_theme_mod( 'parallaxone_facebook_select', $fbdefault);
					if ($fbdef !== $fbdefault) { ?>
					<img src="<?php bloginfo('template_directory'); ?>/images/social/facebook-social.png" />
                    <?php } ?>	
                    
					<?php $twdef = get_theme_mod( 'parallaxone_twitter_select', $twdefault);
					if ($twdef !== $twdefault) { ?>
					<a href="http://www.twitter.com/<?php echo $twdef; ?>"><img src="<?php bloginfo('template_directory'); ?>/images/social/twitter-social.png" /></a>
                    <?php echo $twdefault; ?>
                    <?php } ?>

Open in new window


Basically, what I want to happen is for the social media image to only show if there is a value given by the user.  It works fine for the FB setting and control, but doesn't seem to work for the Twitter Setting and Control.  It shows if either is active. and a blank text box doesn't seem to reset the default to ' ',

I think that is the issue here, but not sure how to reset the text value when no data is provided.
LVL 2
axessJoshAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

axessJoshAuthor Commented:
Ugg, figured it out.

replaced the double equal signs with; != instead.

Works fine now.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.