Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
Last active July 12, 2021 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thecodepoetry/ecafa95cb4e7ae2c6135fe99a734770f to your computer and use it in GitHub Desktop.
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
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' );
@thecodepoetry
Copy link
Author

Add this code in your child theme's functions.php, then use shortcodes [teamposition], [teamsocialinks] in a single team page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment