-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-work-sample.php
150 lines (104 loc) · 3.79 KB
/
single-work-sample.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package understrap
*/
get_header();
$container = get_theme_mod( 'understrap_container_type' );
$sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
?>
<?php if ( is_front_page() && is_home() ) : ?>
<?php get_template_part( 'global-templates/hero', 'none' ); ?>
<?php endif; ?>
<div class="jumbotron header-img" style="background-image: linear-gradient(
rgba(0, 0, 0, 0.45),
rgba(0, 0, 0, 0.45)
), url(<?php echo get_the_post_thumbnail_url(); ?>);">
<div class="header-text">
<h1><?php the_title(); ?></h1>
<p><?php the_terms(get_the_ID(), 'work-sample-tags', 'Tagged with ', ', '); ?></p>
</div>
</div>
<div class="wrapper" id="wrapper-index">
<div class="<?php echo esc_html( $container ); ?>" id="content" tabindex="-1">
<div class="row">
<div class="col-lg-2">
</div>
<div class="col-lg-8">
<main class="site-main" id="main">
<?php if ( have_posts() ) : ?>
<?php $main_title = get_the_title(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="content-section">
<?php the_content(); ?>
</div>
<a href="<?php echo get_post_meta($post->ID, 'url', true); ?>" class="btn btn-secondary btn-block"><i class="fa fa-mouse-pointer"></i> Click Here to View the Project</a>
<br>
<br>
<div class="content-section">
<h3>Faculty Members</h3>
<?php echo get_post_meta($post->ID, 'faculty_', true); ?>
</div>
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'loop-templates/content', 'none' ); ?>
<?php endif; ?>
<div class="content-section">
<h3>Related Projects</h3>
<div class="card-deck">
<?php
$terms = get_the_terms(get_the_ID(), 'work-sample-tags');
$terms_array = array();
foreach($terms as $term){
array_push($terms_array, $term->term_id);
}
$args = array(
'post_type' => 'work-sample',
'post__not_in' => array(get_the_ID()),
'tax_query' => array(
array(
'taxonomy' => 'work-sample-tags',
'field' => 'term_id',
'terms' => $terms_array,
),
),
);
$wp_query = new WP_Query($args);
?>
<?php if ( $wp_query->have_posts() ) : ?>
<!-- pagination here -->
<!-- the loop -->
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<div class="card text-center">
<img src="<?php echo get_the_post_thumbnail_url(); ?>" alt="<?php echo get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true);?>" class="card-img-top">
<div class="card-block">
<h4 class="card-title"><?php the_title(); ?></h4>
<p><?php the_terms(get_the_ID(), 'work-sample-tags', 'Tagged with ', ', '); ?></p>
<a href="<?php the_permalink(); ?>" class="btn btn-primary"> Read More</a>
</div>
</div>
<!-- TODO: Come up with some formatting here for faculty student -->
<?php endwhile; ?>
<!-- end of the loop -->
<!-- pagination here -->
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria. Inside WP loop...' ); ?></p>
<?php endif; ?>
</div><!-- End Card Deck -->
</div>
</main><!-- #main -->
</div><!-- #primary -->
<div class="col-lg-2">
</div>
</div><!-- .row -->
</div><!-- Container end -->
</div><!-- Wrapper end -->
<?php get_footer(); ?>