Last active
September 11, 2019 19:25
-
-
Save KZeni/3c655e5cdb1ffc6da441727b022b5425 to your computer and use it in GitHub Desktop.
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
<?php | |
//About Us Team Shortcode | |
function aboutus_team_member() { | |
global $post; | |
if(get_post_type($post) === 'page'){ | |
ob_start(); | |
$aboutus_team_args = array( | |
'post_type' => 'our-team', | |
'posts_per_page' => -1 | |
); | |
$aboutus_team_query = new WP_Query($aboutus_team_args); | |
if($aboutus_team_query->have_posts()) { | |
$about_i = 1; ?> | |
<div class="aboutus-team"> | |
<?php while ($aboutus_team_query->have_posts()) { $aboutus_team_query->the_post(); | |
$aboutus_member_desc = get_field('team_designation'); | |
$aboutus_member_mail = get_field('team_email'); | |
$aboutus_member_phone = get_field('team_phone'); | |
$aboutus_ph_label = mmi_opts_get('about_member_phone_label'); | |
if( $about_i % 2 == 1 ) { ?> | |
<div class="row"> | |
<?php } ?> | |
<div class="col-lg-6"> | |
<div class="aboutus-member-details"> | |
<div class="row"> | |
<div class="col-md-6"> | |
<div class="about-member-right"> | |
<?php if ( has_post_thumbnail() ) { ?> | |
<div class="aboutus-member-img"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('large', array( 'class' => 'img-fluid' )); ?></a></div> | |
<?php } else { ?> | |
<div class="aboutus-member-img"><a href="<?php the_permalink(); ?>"><img src="<?php mmi_opts_show('default_prop_img'); ?>" class="img-fluid" /></a></div> | |
<?php } ?> | |
</div> | |
</div> | |
<div class="col-md-6"> | |
<div class="about-member-left"> | |
<div class="aboutus-member-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> | |
<?php if( $aboutus_member_desc ) { ?> | |
<div class="aboutus-member-desc"><?php echo $aboutus_member_desc; ?></div> | |
<?php } ?> | |
<?php if( $aboutus_member_phone ) { ?> | |
<div class="aboutus-member-phone"><i class="fa fa-phone"></i> <span><?php if( $aboutus_ph_label ) { echo $aboutus_ph_label; } ?> <a href="tel:<?php echo clean($aboutus_member_phone); ?>"><?php echo $aboutus_member_phone; ?></a></span></div> | |
<?php } ?> | |
<?php if( $aboutus_member_mail ) { ?> | |
<div class="aboutus-member-mail"><i class="fa fa-envelope"></i> <span><a href="mailto:<?php echo trim($aboutus_member_mail); ?>"><?php echo $aboutus_member_mail; ?></a></span></div> | |
<?php } ?> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php if( $about_i % 2 == 0 ) { ?> | |
</div> | |
<?php } ?> | |
<?php $about_i++; } wp_reset_query(); ?> | |
</div> | |
<?php } | |
return ob_get_clean(); | |
}else{ | |
return ''; | |
} | |
} | |
add_shortcode( 'team_members', 'aboutus_team_member' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment