-
Notifications
You must be signed in to change notification settings - Fork 5
/
page-team.php
executable file
·137 lines (108 loc) · 4.13 KB
/
page-team.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/**
* The template for displaying archive pages.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package bbginnovate
template name: Team
*/
/*** SHARING VARS ****/
$teamCategoryID=$_GET["category_id"];
$teamCategory=get_category($teamCategoryID);
$iconName = "bbg-team__icon__".$teamCategory->category_nicename;
$ogTitle=$teamCategory->name . " team page";
$ogDescription=$teamCategory->description;
/*** END SHARING VARS ****/
$numPortfolioPostsToShow=3;
$numBlogPostsToShow=2;
$blogusers = get_users();
$teamLead=false;
foreach($blogusers as $user) {
if ($user->headOfTeam== $teamCategoryID) {
$teamLead=$user;
break;
}
}
$teamPortfolioLink=add_query_arg('category_id', $teamCategoryID, get_permalink( get_page_by_path( 'projects' )));
$fullOddiPorfolioLink=get_permalink( get_page_by_path( 'projects' ));
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div class="usa-grid-full">
<header class="page-header bbg-page__header">
<div class="bbg-avatar__container bbg-team__icon">
<div class="bbg-avatar bbg-team__icon__image <?php echo $iconName ?>" style="background-image: url(<?php echo get_template_directory_uri() ?>/img/icon_team_<?php echo $teamCategory->category_nicename; ?>.png);"></div>
</div>
<div class="bbg-team__text">
<h1 class="page-title bbg-team__name"><?php echo $teamCategory->name; ?> Team</h1>
<h3 class="bbg-team__text-description bbg-page__header-description"><?php echo wptexturize($ogDescription); ?></h3>
<?php
if ($teamLead) {
//bbg_post_author_bottom_card($teamLead->ID);
//var_dump($teamLead);
$authorPath = get_author_posts_url($teamLead -> ID);
echo '<p>Contact: <a href="' . $authorPath . '">' . $teamLead->display_name . '</a></p>';
}
?>
</div>
</header><!-- .page-header -->
<section class="usa-section usa-grid">
<?php $categoryLink=get_category_link( $teamCategoryID ); ?>
<h6 class="bbg-label small"><a href="<?php echo $categoryLink; ?>">Recent posts</a></h6>
<div class="bbg-grid__container">
<?php
$qParams=array(
'post_type' => array('post'),
'posts_per_page' => $numBlogPostsToShow,
'category__in' => [$teamCategoryID],
'category__not_in' => [get_cat_id('Project')]
);
query_posts($qParams);
$numBlogPostsAvailable=$wp_query->found_posts;
while ( have_posts() ) {
the_post();
$gridClass = "bbg-grid--1-2-2";
$includeImage = FALSE;
get_template_part( 'template-parts/content-excerpt', get_post_format() );
}
?>
</div><!-- .bbg-grid__container -->
<?php if ($numBlogPostsAvailable > $numBlogPostsToShow) { ?>
<a href="<?php echo $categoryLink; ?>" style="display: block; clear: left;">Read more <?php echo $teamCategory->name; ?> posts »</a>
<?php } ?>
</section>
<?php
$qParams=array(
'post_type' => array('post'),
'posts_per_page' => $numPortfolioPostsToShow,
'category__and' => [$teamCategoryID, get_cat_id('Project')]
);
query_posts($qParams);
$numProjectsAvailable=$wp_query->found_posts;
if (have_posts()) :
?>
<section class="usa-section usa-grid">
<h6 class="bbg-label small"><a href="<?php echo $teamPortfolioLink; ?>"><?php echo $teamCategory->name; ?> projects</a></h6>
<div class="bbg-grid__container">
<?php
$counter=0;
while ( have_posts() ) {
the_post();
$gridClass = "bbg-grid--1-3-3";
get_template_part( 'template-parts/content-portfolio', get_post_format() );
}
?>
</div><!--.bbg-grid__containter -->
<?php if ($numProjectsAvailable > $numPortfolioPostsToShow) { ?>
<a href="<?php echo $teamPortfolioLink; ?>" style="display:block; clear: left;">Explore the <?php echo $teamCategory->name; ?> portfolio »</a>
<?php } ?>
</section>
<?php
endif;
?>
</div><!-- .usa-grid -->
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>