theme development - get_theme_mod returning no output

I can't work out why this isn't displaying anything. The option appears in the appearance - customise menu, I

I can't work out why this isn't displaying anything. The option appears in the appearance - customise menu, I input my settings and display using:-

<?php get_theme_mod( 'twitter' ); ?>
<?php get_theme_mod( 'facebook' ); ?>

But nothing comes out. Why?

function debut_theme_customizer( $wp_customize ) {

// 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 Twitter Setting
$wp_customize->add_setting( 'twitter' , array( 'default' => '' ));
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'twitter', array(
    'label' => __( 'Twitter', '_s' ),
    'section' => 'social-media',
    'settings' => 'twitter',
) ) );

$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',
) ) );



}
add_action('customize_register', 'debut_theme_customizer');

I can't work out why this isn't displaying anything. The option appears in the appearance - customise menu, I input my settings and display using:-

<?php get_theme_mod( 'twitter' ); ?>
<?php get_theme_mod( 'facebook' ); ?>

But nothing comes out. Why?

function debut_theme_customizer( $wp_customize ) {

// 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 Twitter Setting
$wp_customize->add_setting( 'twitter' , array( 'default' => '' ));
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'twitter', array(
    'label' => __( 'Twitter', '_s' ),
    'section' => 'social-media',
    'settings' => 'twitter',
) ) );

$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',
) ) );



}
add_action('customize_register', 'debut_theme_customizer');
Share Improve this question asked Apr 24, 2015 at 18:48 andyandy 2,3598 gold badges25 silver badges34 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You should do echo output:

<?php echo get_theme_mod( 'twitter' ); ?>
<?php echo get_theme_mod( 'facebook' ); ?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745438914a4627740.html

相关推荐

  • theme development - get_theme_mod returning no output

    I can't work out why this isn't displaying anything. The option appears in the appearance - customise menu, I

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信