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 gratefulThanks in advance
- The topic ‘get_theme_mod function’ is closed to new replies.