-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaxonomy-weblinkcategory.php
144 lines (106 loc) · 3.38 KB
/
taxonomy-weblinkcategory.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
<?php
/**
* Template Name: Taxonomy Weblinkcategory Layout
*
* This template can be used to override the default template and sidebar setup
*
* @package understrap
*/
get_header();
$container = get_theme_mod( 'understrap_container_type' );
$sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
global $titan;
$terms = get_terms( array(
'taxonomy' => 'weblinkcategory',
'hide_empty' => false,
'orderby' => 'none',
//'order' => 'DESC',
) );
?>
<div class="wrapper" id="page-wrapper">
<div class="<?php echo esc_html( $container ); ?>" id="content" tabindex="-1">
<div class="row">
<div class="col-md-4 widget-area" id="left-sidebar" role="complementary">
<aside id="weblink_category_menu" class="weblink-category">
<?php
echo '<ul class="sub-pages weblink-category-menu">';
foreach ( $terms as $term ) {
echo '<li>';
echo '<a href="/?weblinkcategory='. $term->name .'">' .
$term->name . '</a></a>';
echo '</li>';
}
echo '</ul>';
?>
</aside>
</div>
<div class="col-md-8 content-area" id="primary">
<main class="site-main" id="main">
<?php //get_template_part( 'loop-templates/content', 'page' ); ?>
<header class="entry-header">
<h2 class="entry-title">
<?php single_term_title(); ?>
</h2>
</header>
<div class="entry-content clearfix">
<section class="weblinkcategory-section">
<?php
//Query
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$the_query = new WP_Query( array(
'paged' => $paged,
'post_type' => 'weblinks',
'tax_query' => array(
array(
'taxonomy' => 'weblinkcategory',
'field' => 'slug',
'terms' => array( $term->slug ),
),
),
'post_status' => 'publish',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => -1,
) );
//The Loop
if ( $the_query->have_posts() ) {
echo '<div class="catalogue-table">';
//echo $thead;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output = '<div style="width: 25%; display: inline-block;">';
$output .= '<a href="'. esc_url($titan->getOption('weblinks_site_url')) .'" target="_blank">';
$output .= get_the_title();
$output .= '</a>';
$output .= '</div>';
echo $output;
//get_template_part('/staffz/content','catalogue-staff');
endwhile;
echo '</div>';
//Restore original Post Data
wp_reset_postdata();
} else {
// no posts found
echo '<p>' . _x('No link found in this category', 'weblinks', 'mh-magazine') . '</p>';
}
?>
</section>
</div>
<?php
// if(is_super_admin()) {
// print "<pre>";
// print_r($terms);
// print "</pre>";
// }
?>
</main>
<!-- #main -->
</div>
<!-- Do the right sidebar check -->
<?php if ( 'right' === $sidebar_pos || 'both' === $sidebar_pos ) : ?>
<?php get_sidebar( 'right' ); ?>
<?php endif; ?>
</div><!-- .row -->
</div><!-- Container end -->
</div><!-- Wrapper end -->
<?php get_footer(); ?>