$socials = client_info('social');
if ( ! empty($socials) ) {
$output .= '<ul id="footer-social" class="nobull">';
foreach ( $socials as $key => $value) {
$output .= '<li class="social-' . $key .'">';
if ( $value['icon'] ) {
$icon = $value['icon'];
} else {
$icon = 'fa fa-' . $key;
}
$output.= '<a class="' . $icon . '" href="' . $value['url'] .'">';
$output.= '<span>';
$output.= $value['name'];
$output.= '</span>';
$output.= '</a>';
$output .= '</li>';
}
$output .= '</ul>';
}
<?php
function client_info( $key = NULL ) {
$values = array(
'phone' => '1.555.5555',
'fax' => '1.555.5555',
'email' => 'info@example.com',
'social' => array (
'facebook' => array(
'url' => '#',
'name' => 'Facebook',
'icon' => 'fa fa-facebook-official',
),
'instagram' => array(
'url' => '#',
'name' => 'Instagram',
),
'twitter' => array(
'url' => '#',
'name' => 'Twitter',
),
'linkedin' => array(
'url' => '#',
'name' => 'LinkedIn',
),
'youtube' => array(
'url' => '#',
'name' => 'YouTube',
'icon' => 'fa fa-youtube-play',
),
),
'address' => '123 Te st. Testington, CA 90210',
'hours' => 'Open M-F 9a-5p',
);
if ( isset($key) ) {
$output = $values[$key];
} else {
$output = $values;
}
return $output;
}