WordPress如何在视图中显示skill1_logo

你好, 我是新手, 我想问一下如何在所需页面上显示skill1_logo, skill1_title, skill1_description。我正在尝试使用wordpress来练习我的wordpress来建立一个1页的网站。

function theme_skills_customizer($wp_customize){ //adding section in wordpress customizer $wp_customize-> add_section('skills_settings_section', array( 'title'=> 'Skills Section' )); $wp_customize-> add_setting('skill1_logo'); $wp_customize-> add_setting('skill1_title'); $wp_customize-> add_setting('skill1_description'); $wp_customize-> add_control( new WP_Customize_Image_Control( $wp_customize, 'skill1_logo', array( 'label'=> __( 'Skill 1 Logo', 'themeslug' ), 'width'=> 400, 'height'=> 400, 'flex-width'=> true, 'flex-height'=> true, 'section'=> 'skills_settings_section', 'settings' => 'skill1_logo', ))); $wp_customize-> add_control( 'skill1_title', array( 'label' => __( 'Skill 1 Title' ), 'section' => 'skills_settings_section', // Add a default or your own section 'type' => 'text', )); $wp_customize-> add_control( 'skill1_description', array( 'label' => __( 'Skill 1 Description' ), 'section' => 'skills_settings_section', // Add a default or your own section 'type' => 'textarea', )); }add_action( 'customize_register', 'theme_skills_customizer' );

#1你可以使用get_theme_mod函数来回显这些设置。
【WordPress如何在视图中显示skill1_logo】例如
$s_title = get_theme_mod('skill1_title');

    推荐阅读