Title: get_theme_mod function
Last modified: August 22, 2016

---

# get_theme_mod function

 *  [Cskinner387](https://wordpress.org/support/users/cskinner387/)
 * (@cskinner387)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/get_theme_mod-function/)
 * Hey There,
    I have been trying to add social icons to the header bar, using the
   customizer and fuction settings i have managed to add the details to the customizer
   so users can input details for their accounts, it was done like this
 *     ```
       // Add Social Media Section
       	$wp_customize->add_section( 'social-media' , array(
           'title' => __( 'Social Media', '_s' ),
           'priority' => 30,
           'description' => __( 'Enter the URL to your account for each service for the icon to appear in the header.', '_s' )
       	) );
   
       	// Add Facebook Setting
       	$wp_customize->add_setting( 'Facebook' , array( 'default' => '' ));
       	$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'Facebook', array(
           'label' => __( 'Facebook', '_s' ),
           'section' => 'social-media',
           'settings' => 'Facebook',
       	) ) );
       ```
   
 * But now I am trying to add in the code into the header to call the setting in,
   but i wanted to do it, so when you dont imput a setting the icon does not appear
   but everytime i place code in the icon appears whether there is an entry for 
   that setting or not. This code is placed like this
 * `<li><a class="fa fa-twitter-square fa-2x" href="<?php get_theme_mod( 'twitter');?
   >" title="Twitter" target="_blank"></a></li>`
 * I’m pretty new to all this stuff and i still trying to learn how functions and
   the customizer, and how that side of wordpress works.
    Any help that anyone could
   advise I would be very very grateful
 * Thanks in advance

Viewing 1 replies (of 1 total)

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [11 years, 3 months ago](https://wordpress.org/support/topic/get_theme_mod-function/#post-5856384)
 * What’s cool is that [get_theme_mod](https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/theme.php#L905)
   returns false if there is no default set or if the mod doesn’t exist.
 * What many do is check
 *     ```
       if ( '' !== get_theme_mod( 'theme_setting' ) ){ }
       - or -
       if ( get_theme_mod( 'theme_setting' ) ) { }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘get_theme_mod function’ is closed to new replies.

## Tags

 * [header](https://wordpress.org/support/topic-tag/header/)
 * [social](https://wordpress.org/support/topic-tag/social/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/get_theme_mod-function/#post-5856384)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
