如何输出自定义功能的社会图标列表


How to output a list of social icons in custom function?

我有一个无序的社交图标列表,我想输出,但我对如何用我当前的函数(使用数组,$figure?) -

所以我的原始代码是当前(检查字段是否填充,如果是,显示前端的图标)-

<?php if ( get_post_meta( $post->ID, 'member_twitter', true ) ) { ?>
<li><a href="<?php echo get_post_meta( $post->ID, 'member_twitter', true ) ?>" title="<?php _e( 'View Twitter Profile', 'booka' ); ?>"><i class="fa fa-twitter"></i></a></li>
<?php } if ( get_post_meta( $post->ID, 'member_facebook', true ) ) { ?>
<li><a href="<?php echo get_post_meta( $post->ID, 'member_facebook', true ) ?>" title="<?php _e( 'View FaceBook Profile', 'booka' ); ?>"><i class="fa fa-facebook"></i></a></li>
<?php } if ( get_post_meta( $post->ID, 'member_googleplus', true ) ) { ?>
<li><a href="<?php echo get_post_meta( $post->ID, 'member_googleplus', true ) ?>" title="<?php _e( 'View Google Plus Profile', 'booka' ); ?>"><i class="fa fa-google-plus"></i></a></li>
<?php } ?>

现在我想将这些列表项插入到下面(并循环遍历它们)-

if ($layout_style == "style-one") {
                $html .= "<div class='team-member'>";
                $html .= "<h3 class='member-name'>$title</h3>";
                $html .= "<div class='member-role'>$member_role</div>";
                $html .= "<ul class='social-icons'>";
                $html .= "</ul>";
                $html .= "</div>";
            }

我已经尝试了一些不成功的方法。

谢谢

我想我知道你想要什么。如果我写错了请告诉我:

$socials = array(
    array('twitter', 'Twitter', 'twitter'),
    array('facebook', 'FaceBook', 'facebook'),
    array('googleplus', 'Google Plus', 'google-plus'),
);
if ($layout_style == "style-one") {
    $html .= "<div class='team-member'>";
    $html .= "<h3 class='member-name'>$title</h3>";
    $html .= "<div class='member-role'>$member_role</div>";
    $html .= "<ul class='social-icons'>";
    foreach ($socials as $social) {
        if (get_post_meta($post->ID, 'member_' . $social[0], true)) {
            $html .= "<li><a href='"" . get_post_meta($post->ID, 'member_' . $social[0], true) . "'" title='"" . _e('View " . $social[1] . " Profile', 'booka') . "'"><i class='"fa fa-" . $social[2] . "'"></i></a></li>";
        }
    }
    $html .= "</ul>";
    $html .= "</div>";
}