我一直在学习如何为主题创建主题定制器功能。我一直在学习如何使社交媒体图标显示在页脚上。
我已经包含了必须包含在函数中的文件。php。但在主题定制器的前端,我的设置不会显示并收到错误消息。
我正在学习,只是想看看是否可行,看看:https://www.competethemes.com/blog/social-icons-wordpress-menu-theme-customizer/#comment-20708
警告:call\\u user\\u func\\u array()要求参数1为有效回调,在/Users/brandonpowell/sites/valet/alter-theme/web/wp/wp-includes/class-wp-hook中找不到函数“rixcy\\u scripts”,或函数名无效。php第298Footer行。php
<?php
?>
<!-- #content -->
<div class="footer">
<div class="main-content">
<div class="width-6">
<img src="img/AlterEgo-Branding-text-color.png">
</div>
<div class="width-6">
</div>
</div>
</div>
<div class="social">
<div class="main-content">
<?php require get_template_directory() . \'/inc/outputicons.php\'; ?>
</div>
</div>
<?php wp_footer(); ?>
</body>
</html>
社会客户部门。php
<?php
function my_add_customizer_sections( $wp_customize ) {
$social_sites = ct_atlers_social_array();
// set a priority used to order the social sites
$priority = 5;
// section
$wp_customize->add_section( \'ct_alter_social_array_filter\', array(
\'title\' => __( \'Social Media Icons\', \'alter\' ),
\'priority\' => 12,
\'description\' => __( \'Add the URL for each of your social profiles.\', \'alter\' )
) );
// create a setting and control for each social site
foreach ( $social_sites as $social_site => $value ) {
$label = ucfirst( $social_site );
if ( $social_site == \'google-plus\' ) {
$label = \'Google Plus\';
} elseif ( $social_site == \'twitter\' ) {
$label = \'Twitter\';
} elseif ( $social_site == \'facebook\' ) {
$label = \'Facebook\';
} elseif ( $social_site == \'Github\' ) {
$label = \'github\';
} elseif ( $social_site == \'linkedin\' ) {
$label = \'Linkedin\';
} elseif ( $social_site == \'youtube\' ) {
$label = \'Youtube\';
} elseif ( $social_site == \'instagram\' ) {
$label = \'Instagram\';
} elseif ( $social_site == \'instagram\' ) {
$label = \'Instagram\';
} elseif ( $social_site == \'dribbble\' ) {
$label = \'dribbble\';
} elseif ( $social_site == \'behance\' ) {
$label = \'behance\';
} elseif ( $social_site == \'behance\' ) {
$label = \'behance\';
} elseif ( $social_site == \'email-form\' ) {
$label = \'Contact Form\';
}
// setting
$wp_customize->add_setting( $social_site, array(
\'sanitize_callback\' => \'esc_url_raw\'
) );
// control
$wp_customize->add_control( $social_site, array(
\'type\' => \'url\',
\'label\' => $label,
\'section\' => \'ct_tribes_social_media_icons\',
\'priority\' => $priority
) );
// increment the priority for next site
$priority = $priority + 5;
}
}
add_action( \'customize_register\', \'my_add_customizer_sections\' );
输出。php
<?php
function my_social_icons_output() {
$social_sites = ct_atlers_social_array();
foreach ( $social_sites as $social_site => $profile ) {
if ( strlen( get_theme_mod( $social_site ) ) > 0 ) {
$active_sites[ $social_site ] = $social_site;
}
}
if ( ! empty( $active_sites ) ) {
echo \'<ul class="social-media-icons">\';
foreach ( $active_sites as $key => $active_site ) {
$class = \'fa fa-\' . $active_site; ?>
<li>
<a class="<?php echo esc_attr( $active_site ); ?>" target="_blank" href="<?php echo esc_url( get_theme_mod( $key ) ); ?>">
<i class="<?php echo esc_attr( $class ); ?>" title="<?php echo esc_attr( $active_site ); ?>"></i>
</a>
</li>
<?php }
echo "</ul>";
}
}
社交阵列。php
<?php
function ct_atlers_social_array() {
$social_sites = array(
\'twitter\' => \'alter_twitter_profile\',
\'facebook\' => \'alter_facebook_profile\',
\'google-plus\' => \'alter_googleplus_profile\',
\'linkedin\' => \'alter_linkedin_profile\',
\'youtube\' => \'alter_youtube_profile\',
\'instagram\' => \'alter_instagram_profile\',
\'dribbble\' => \'alter_dribbble_profile\',
\'behance\' => \'alter_behance_profile\',
\'github\' => \'alter_github_profile\',
\'email_form\' => \'alter_email_profile\',
);
return apply_filters( \'ct_alter_social_array_filter\', $social_sites );
}