-
Notifications
You must be signed in to change notification settings - Fork 16
/
page-explore.php
73 lines (50 loc) · 1.71 KB
/
page-explore.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
<?php
/**
* Description of Template goes here
*
Template Name: Explore
*/
?>
<?php get_header(); ?>
<?php
// global $wp_query;
// $term = $wp_query->get_queried_object();
// $taxonomy = $term->taxonomy; // This is the Taxonomy Title
// $taxonomy_term = $term->name;
//
//print_r($wp_query);
//var_dump(get_defined_vars());
$getsubject = htmlspecialchars($_GET["subject"]);
$getdemographic = htmlspecialchars($_GET["demographic"]);
$getsearch = htmlspecialchars($_GET["searchterm"]);
// echo $getsubject;
// echo $getdemographic;
if(!empty($getsubject) && !empty($getdemographic)) { $and = " and "; }
$propersubject = get_term_by( 'slug', $getsubject, 'subject');
//echo $propersubject->name;
$properdemographic = get_term_by( 'slug', $getdemographic, 'demographic');
//echo $properdemographic->name;
?>
<!-- <h2 class="sp-header"><?php echo $taxonomy; /*** This is the title of the taxonomy -- such as "Subjects" or "Demographics" ***/ ?></h2> -->
<div id="intro">
<?php if ( $getsearch ) { ?>
<h1>Chart results for "<?php echo $getsearch; ?>" in <?php echo $propersubject->name . $and . $properdemographic->name; ?></h1>
<?php } else { ?>
<h1>Chart results for <?php echo $propersubject->name . $and . $properdemographic->name; ?></h1>
<?php } ?>
</div>
<?php
// $wp_query = new WP_Query( "subject=$getsubject&demographic=$getdemographic&posts_per_page=-1&post_type=post,chart&s=$getsearch" );
$wp_query = new WP_Query( array(
"subject" => $getsubject,
"demographic" => $getdemographic,
"orderby" => 'title',
"order" => 'asc',
"posts_per_page" => -1,
"post_type" => array('post', 'chart'),
));
?>
<?php get_template_part( 'loop', 'charts-new' ); ?>
</div>
<?php get_sidebar() ?>
<?php get_footer(); ?>