-
Notifications
You must be signed in to change notification settings - Fork 6
/
hooks.php
108 lines (86 loc) · 3.71 KB
/
hooks.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
<?php
/*
* We have created our custom hooks for this theme, so the theme can be flexible and extendable throught child theme.
* For more details https://codex.wordpress.org/Plugin_API
*
*
* @package WordPress
* @subpackage Skin
* @since Skin 1.0
*/
/*
* Adding custom layout files selected in the theme customizer by the user.
* Priority level set to 60. Higher the number, the lower the priority.
*
* @since Skin 1.0
*/
// get_theme_mod('featured_on_off','1');
// For Adding Featured area in HomePage
add_action('index_content_area_hook','featured_file_include_home', 40 );
function featured_file_include_home() {
if (get_theme_mod('home_switch_new','1') == '1' ) {
if (get_theme_mod('featured_style_selector', 'skin_1') === 'skin_1') {
get_template_part( 'elements/featured/featured', '1' );
}
if (get_theme_mod('featured_style_selector', 'skin_1') === 'skin_2') {
get_template_part( 'elements/featured/featured', '2' );
}
if (get_theme_mod('featured_style_selector', 'skin_1') === 'skin_3') {
get_template_part( 'elements/featured/featured', '3' );
}
}
}
// For Homepage, Archive page and others
add_action('index_content_area_hook','template_file_include_home', 60 );
function template_file_include_home() {
if (get_theme_mod('post_area_style_selector', 'skin_1') === 'skin_1') {
get_template_part('elements/home-layout/layout','1');
}
if (get_theme_mod('post_area_style_selector', 'skin_1') === 'skin_2') {
get_template_part('elements/home-layout/layout','2');
}
if (get_theme_mod('post_area_style_selector', 'skin_1') === 'skin_3') {
get_template_part('elements/home-layout/layout','3');
}
}
// For Single/Post page.( for single.php )
add_action('single_content_area_hook','template_file_include_single', 60 );
function template_file_include_single() {
get_template_part('elements/single-layout/layout','1');
}
// For Page Content.( for page.php )
add_action('page_content_area_hook','template_file_include_page', 60 );
function template_file_include_page() {
get_template_part('elements/page','content');
}
// For Archive/Category page.( for archive.php )
add_action('archive_content_area_hook','template_file_include_archive', 60 );
function template_file_include_archive() {
if (get_theme_mod('post_area_style_selector', 'skin_1') === 'skin_1') {
get_template_part('elements/home-layout/layout','1');
}
if (get_theme_mod('post_area_style_selector', 'skin_1') === 'skin_2') {
get_template_part('elements/home-layout/layout','2');
}
if (get_theme_mod('post_area_style_selector', 'skin_1') === 'skin_3') {
get_template_part('elements/home-layout/layout','3');
}
}
/*
* Adding footer layouts directly to wp_footer() with the priority level set to 2, so layout files is called before Enqueue styles and scripts.
*Enqueued scripts are executed at priority level 20. Higher the number, the lower the priority.
*
* @since Skin 1.0
*/
add_action('wp_footer','template_file_include_footer', 2 );
function template_file_include_footer() {
if (get_theme_mod('footer_style_selector', 'skin_1') === 'skin_1') {
get_template_part('elements/footer/footer','1');
}
if (get_theme_mod('footer_style_selector', 'skin_1') === 'skin_2') {
get_template_part('elements/footer/footer','2');
}
if (get_theme_mod('footer_style_selector', 'skin_1') === 'skin_3') {
get_template_part('elements/footer/footer','3');
}
}