-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
184 lines (117 loc) · 4.47 KB
/
home.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
<?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';
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">
<?php if ( is_home() ) : ?>
<h1 class="page-title">
<?php echo get_the_title( get_option('page_for_posts', true) ); ?>
</h1>
<?php endif; ?>
</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">
<label for="cat"><span class="sr-only">Select Category</span></label>
<?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_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();