-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-trivbe_events.php
224 lines (141 loc) · 5.49 KB
/
archive-trivbe_events.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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?php
/**
* This file adds the Archive Post Template to any Genesis child theme.
*
* @author Artversion
* @link https://artversion.com/
*/
//* Add custom body class to the head
add_filter( 'body_class', 'single_posts_body_class' );
function single_posts_body_class( $classes ) {
$classes[] = 'news-cat event-cat';
return $classes;
}
function be_blog_archive_intro() {
// Copied genesis_do_posts_page_heading() from lib/structure/archive.php
if ( ! genesis_a11y( 'headings' ) ) {
return;
}
$posts_page = get_option( 'page_for_posts' );
if ( null === $posts_page ) {
return;
}
if ( ! is_home() || genesis_is_root_page() ) {
return;
}
/** This action is documented in lib/structure/archive.php */
do_action( 'genesis_archive_title_descriptions', get_the_title( $posts_page ), get_post( $posts_page )->post_content, 'posts-page-description' );
}
remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
add_action( 'genesis_before_loop', 'be_blog_archive_intro' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_header', 'genesis_post_info', 9 );
// Filter Post Meta and Use it Condtionally
add_filter( 'genesis_post_info', 'leaguewp_post_info_filter' );
function leaguewp_post_info_filter($post_info) {
$post_info = '[post_date]';
return $post_info;
}
add_action( 'genesis_entry_header', 'sk_do_post_title_before', 7 );
function sk_do_post_title_before() {
echo '<div class="my-entry-title">';
}
// Add custom closing div for post title
add_action( 'genesis_entry_header', 'sk_do_post_title_after' );
function sk_do_post_title_after() {
echo '</div>';
}
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
//* Remove custom headline and / or description to category / tag / taxonomy archive pages.
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
//* Remove custom headline and description to blog template pages.
remove_action( 'genesis_before_loop', 'genesis_do_blog_template_heading' );
//* Remove custom headline and description to date archive pages.
remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' );
//* Remove custom headline and description to author archive pages.
remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 );
//* Remove custom headline and description to relevant custom post type archive pages.
remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' );
add_action('genesis_before_content', function(){?>
<div class="heading-box">
<div class="wp-block-group custom-blog-entry-heading blue-pattern">
<div class="wp-block-group__inner-container">
<div class="wp-block-group fixed-1180 entry-header-wrap">
<div class="wp-block-group__inner-container">
<h1 class="page-title"><?php echo single_term_title(); ?></h1>
<div class="subtitle"><?php echo term_description(); ?></div>
</div>
</div>
</div>
</div>
</div>
<section class="main-cat-loop">
<div class="sub-heading-box">
<?php if ( is_active_sidebar( 'category-header-widget-top' ) ) : ?>
<div class="search">
<?php
dynamic_sidebar( 'category-header-widget-top' );
?>
</div>
<?php endif; ?>
<div class="cat-select">
<div class="cat-select-in">
<?php wp_dropdown_categories( 'show_option_none=Category&show_count=1&hierarchical=1' ); ?>
</div>
<script type="text/javascript">
<!--
var dropdown = document.getElementById("cat");
function onCatChange() {
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
location.href = "<?php echo esc_url( home_url( '/' ) ); ?>?cat="+dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
-->
</script>
</div>
</div>
</section>
<?php }); ?>
<?php
add_action('genesis_before_loop', 'art_change_home_loop');
function art_change_home_loop() {
/** Replace the home loop with our custom **/
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'art_custom_loop' );
/** Custom loop **/
function art_custom_loop() {
?>
<?php
/*
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
*/
global $post;
$cat_obj = get_queried_object();
$thiscat_id = $cat_obj->term_id;
$thiscat = get_category($thiscat_id);
$parentcat = get_category($thiscat->parent);
$cat = get_query_var('news');
$category = get_category ($thiscat);
// echo '<h1>'.$category->cat_name.'</h1>';
echo do_shortcode('[ajax_load_more category="'.$category->slug.'" cache="true" cache_id="cache-'.$category->slug.'" posts_per_page="9"]');
}
}
?>
</section>
<?php
add_action('genesis_after_loop', function(){?>
<div class="category-media-footer">
<?php if ( is_active_sidebar( 'category-media-footer' ) ) : ?>
<div class="form-box-footer">
<?php
dynamic_sidebar( 'category-media-footer' );
?>
</div>
<?php endif; ?>
</div>
<?php }); ?>
<?php
//* Run the Genesis loop
genesis();