admin管理员组文章数量:1424916
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
1 Answer
Reset to default 1You should do echo output:
<?php echo get_theme_mod( 'twitter' ); ?>
<?php echo get_theme_mod( 'facebook' ); ?>
本文标签: theme developmentgetthememod returning no output
版权声明:本文标题:theme development - get_theme_mod returning no output 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745438914a2658356.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论