-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschools.php
More file actions
179 lines (151 loc) · 5.41 KB
/
schools.php
File metadata and controls
179 lines (151 loc) · 5.41 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
/**
* Template Name: Schools
* school.php
*
* The Template for displaying all single school posts.
*
* @author Zlatko Gantchev
* @package Parentory
* @since 1.0.0 - 05.02.2014
*/
get_header(); ?>
<div id="main-image" class="row">
<img src="http://parentory.ca/deploy/wp-content/uploads/2014/05/montessori-schools.jpg">
</div>
<section id="primary" class="span12">
<div id="archive-content" role="main" class="container-fluid">
<div id="school-listings-filter" class="container-fluid">
<div class="row-fluid">
<div class="span12">
<h2>Find a Location Near You</h2>
Enter preferred location to search through schools:
</div>
</div>
<form id="search-form" method="post" action="<?php append_website_URL('school-search-results/'); ?>">
<input name="search-type" type="hidden" value="directory-page-search">
<div class="row-fluid">
<div class="span12 school-filter-form">
<input type="text" class="filter-form-address" name="address" placeholder="Enter City or Address Here">
<select name="province">
<option value="All Provinces">All States/Provinces</option>
<option value="Alberta">Alberta</option>
<option value="British Columbia">British Columbia</option>
<option value="Manitoba">Manitoba</option>
<option value="New Brunswick">New Brunswick</option>
<option value="Newfoundland Labrador">Newfoundland and Labrador</option>
<option value="Nova Scotia">Nova Scotia</option>
<option value="Ontario">Ontario</option>
<option value="Prince Edward Island">Prince Edward Island</option>
<option value="Quebec">Quebec</option>
<option value="Saskatchewan">Saskatchewan</option>
<option value="Northwest Territories">Northwest Territories</option>
<option value="Nunavut">Nunavut</option>
<option value="Yukon">Yukon</option>
</select>
</div>
</div>
<div class="row-fluid">
<div id="archive-filter-button-field" class="span12">
<input type="submit" name="submit" class="submitButton" value="Search">
</div>
</div>
</form>
<div class="row-fluid">
<div id="archive-filter-bottom" class="span12">
<a href="<?php append_website_URL('advanced-search/'); ?>">Advanced Search</a>
</div>
</div>
</div>
<?php
// protect against arbitrary paged values
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
// set up the query
$args = array( 'post_type' => 'school', 'posts_per_page' => 7, 'orderby' => 'title', 'order' => 'ASC', 'paged' => $paged);
$the_query = new WP_Query( $args );
$first_post = true;
// check if there's posts to be shown
if ( $the_query->have_posts() ) {
// begin The Loop
while ( $the_query->have_posts() ) {
// iterate the post index within The Loop
$the_query->the_post();
// get the current school id - used for finding mega data
$school_id = get_the_id();
// omit row divider for the first post
if ( $first_post )
$first_post = false;
else
echo "<hr>";
?>
<div id="school-archive-entry" class="row-fluid">
<!-- display school image -->
<div class="span2 archive-school-logo-holder">
<a class="read-more" target="_blank" href="<?php the_permalink( $school_id ); ?>">
<?php the_post_thumbnail( 'full', array( 'class' => 'archive-school-logo' ) ); ?>
</a>
</div>
<!-- display school title & info -->
<div class="span5">
<div id="school-title-archive" class="entry-title">
<a target="_blank" href="<?php the_permalink( $school_id ); ?>">
<?php the_title(); ?>
</a>
</div>
<div>
<i>
<?php echo get_school_address( $school_id, array('street-address', 'city', 'province', 'postal-code') ); ?>
</i>
</div>
<div class="school-excerpt">
<?php the_excerpt(); ?>
<a class="read-more" target="_blank" href="<?php the_permalink( $school_id ); ?>"><i>(learn more)</i></a>
</div>
</div>
<!-- display school age & price info -->
<div class="span5">
<span class="archive-school-data-box">
<div><b>Grades</b></div>
<?php render_school_info($school_id, 'grades') ?>
</span>
<span class="archive-school-data-box">
<div><b>Tuition</b></div>
<?php render_school_info($school_id, 'annual-tuition') ?>
</span>
<span class="archive-school-data-box">
<div><b>School Type</b></div>
<?php render_school_type($school_id) ?>
</span>
<span class="archive-school-data-box">
<div><b>Class Size</b></div>
<?php render_school_info($school_id, 'class-size') ?>
</span>
</div>
</div>
<?php
}
} else {
//no posts found, TODO: put placeholder stuff here
}
?>
<center id="school-archive-bottom">
<?php
$big = 999999999; // need an unlikely integer
// separate results into distinct pages
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $the_query->max_num_pages
) );
//Restore original Post Data
wp_reset_postdata();
?>
</center>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_footer();
/* End of file schools.php */
/* Location: ./wp-content/themes/the-bootstrap-child/shools.php */
?>