Skip to content

Instantly share code, notes, and snippets.

@TanvirAmi
Last active September 24, 2018 21:36
Show Gist options
  • Save TanvirAmi/0ad4cc2b5f756a3fddd5b07fe70ac676 to your computer and use it in GitHub Desktop.
Save TanvirAmi/0ad4cc2b5f756a3fddd5b07fe70ac676 to your computer and use it in GitHub Desktop.
Team template for Theme Junkie team content plugin
<?php
/**
* Template Name: Teams template
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main" <?php hybrid_attr( 'content' ); ?>>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php hybrid_attr( 'post' ); ?>>
<?php
// Check if the required plugin is active.
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'theme-junkie-team-content/tj-team-content.php' ) ) :
?>
<header class="entry-header">
<?php the_title( '<h1 class="page-title" ' . hybrid_get_attr( 'entry-title' ) . '>', '</h1>' ); ?>
</header>
<div class="entry-content" <?php hybrid_attr( 'entry-content' ); ?>>
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'flatline' ),
'after' => '</div>',
) );
?>
<?php $args = apply_filters( 'flatline_team_query', array( 'post_type' => 'member', 'posts_per_page' => -1 ) ); ?>
<?php $teams = new WP_Query( $args ); ?>
<?php if ( $teams->have_posts() ) : ?>
<div class="team-members">
<ul class="members">
<?php while ( $teams->have_posts() ) : $teams->the_post(); ?>
<li class="member">
<div class="member-photo">
<img src="<?php echo esc_url( get_post_meta( get_the_ID(), 'tj_member_avatar', true ) ); ?>" alt="<?php the_title(); ?>">
<ul class="member-social clearfix">
<li><a href="<?php echo esc_url( get_post_meta( get_the_ID(), 'tj_member_twitter_url', true ) ); ?>"><span class="genericon genericon-twitter"></span></a></li>
<li><a href="<?php echo esc_url( get_post_meta( get_the_ID(), 'tj_member_facebook_url', true ) ); ?>"><span class="genericon genericon-facebook"></span></a></li>
<li><a href="<?php echo esc_url( get_post_meta( get_the_ID(), 'tj_member_googleplus_url', true ) ); ?>"><span class="genericon genericon-googleplus"></span></a></li>
<li><a href="<?php echo esc_url( get_post_meta( get_the_ID(), 'tj_member_linkedin_url', true ) ); ?>"><span class="genericon genericon-linkedin-alt"></span></a></li>
<li><a href="<?php echo esc_url( get_post_meta( get_the_ID(), 'tj_member_pinterest_url', true ) ); ?>"><span class="genericon genericon-pinterest-alt"></span></a></li>
<li><a href="<?php echo esc_url( get_post_meta( get_the_ID(), 'tj_member_dribbble_url', true ) ); ?>"><span class="genericon genericon-dribbble"></span></a></li>
</ul>
</div>
<div class="member-content">
<h3 class="member-name"><?php the_title(); ?></h3>
<p class="member-position"><?php echo esc_attr( get_post_meta( get_the_ID(), 'tj_member_position', true ) ); ?></p>
<div class="member-desc"><?php the_content(); ?></div>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
</div><!-- .entry-content -->
<?php endif; wp_reset_postdata(); ?>
<?php else : ?>
<div class="entry-content">
<p><?php printf( __( 'Please install %1$sTheme Junkie Team Content%2$s plugin to use this page template.', 'flatline' ), '<a href="http://wordpress.org/plugins/theme-junkie-team-content/" target="_blank">', '</a>' ); ?></p>
</div><!-- .entry-content -->
<?php endif; ?>
</article>
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment