Last active
July 12, 2021 11:09
-
-
Save thecodepoetry/ecafa95cb4e7ae2c6135fe99a734770f to your computer and use it in GitHub Desktop.
To display team details and social link on single team page using shortcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function teamposition_func( $atts ){ | |
$config = presscore_config(); | |
presscore_populate_team_config(); | |
$position = $config->get( 'post.member.position' ); | |
if($position) { | |
return '<p>'.$position.'<p>'; | |
} | |
} | |
add_shortcode( 'teamposition', 'teamposition_func' ); | |
function teamsocialinks_func( $atts ){ | |
$config = presscore_config(); | |
presscore_populate_team_config(); | |
$clear_links = array(); | |
$links = $config->get( 'post.preview.links' ); | |
if ( function_exists('presscore_get_team_links_array') ) { | |
foreach ( presscore_get_team_links_array() as $id=>$data ) { | |
if ( array_key_exists( $id , $links ) ) { | |
$clear_links[] = presscore_get_social_icon( $id, $links[ $id ], $data['desc'] ); | |
} | |
} | |
} | |
// Output soc links | |
if ( !empty( $clear_links ) ) { | |
return '<div class="soc-ico">' . implode( '', $clear_links ) . '</div>'; | |
} | |
} | |
add_shortcode( 'teamsocialinks', 'teamsocialinks_func' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this code in your child theme's functions.php, then use shortcodes [teamposition], [teamsocialinks] in a single team page