forked from JeremyEnglert/JointsWP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
189 lines (168 loc) · 7.35 KB
/
functions.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
<?php
ob_start();
/*********************
INCLUDE NEEDED FILES
*********************/
// LOAD JOINTSWP CORE (if you remove this, the theme will break)
require_once(get_template_directory().'/library/joints.php');
// USE THIS TEMPLATE TO CREATE CUSTOM POST TYPES EASILY
require_once(get_template_directory().'/library/custom-post-type.php'); // you can disable this if you like
// CUSTOMIZE THE WORDPRESS ADMIN (off by default)
// require_once(get_template_directory().'/library/admin.php');
// SUPPORT FOR OTHER LANGUAGES (off by default)
// require_once(get_template_directory().'/library/translation/translation.php');
/*********************
MENUS & NAVIGATION
*********************/
// REGISTER MENUS
register_nav_menus(
array(
'top-nav' => __( 'The Top Menu' ), // main nav in header
'main-nav' => __( 'The Main Menu' ), // main nav in header
'footer-links' => __( 'Footer Links' ) // secondary nav in footer
)
);
// THE TOP MENU
function joints_top_nav() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container (should you choose to use it)
'menu' => __( 'The Top Menu', 'jointstheme' ), // nav name
'menu_class' => '', // adding custom nav class
'theme_location' => 'top-nav', // where it's located in the theme
'before' => '', // before the menu
'after' => '', // after the menu
'link_before' => '', // before each link
'link_after' => '', // after each link
'fallback_cb' => 'joints_main_nav_fallback' // fallback function
));
} /* end joints main nav */
// THE MAIN MENU
function joints_main_nav() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container (should you choose to use it)
'menu' => __( 'The Main Menu', 'jointstheme' ), // nav name
'menu_class' => '', // adding custom nav class
'theme_location' => 'main-nav', // where it's located in the theme
'before' => '', // before the menu
'after' => '', // after the menu
'link_before' => '', // before each link
'link_after' => '', // after each link
'fallback_cb' => 'joints_main_nav_fallback' // fallback function
));
} /* end joints main nav */
// THE FOOTER MENU
function joints_footer_links() {
wp_nav_menu(array(
'container' => '', // remove nav container
'container_class' => 'footer-links clearfix', // class of container (should you choose to use it)
'menu' => __( 'Footer Links', 'jointstheme' ), // nav name
'menu_class' => 'sub-nav', // adding custom nav class
'theme_location' => 'footer-links', // where it's located in the theme
'before' => '', // before the menu
'after' => '', // after the menu
'link_before' => '', // before each link
'link_after' => '', // after each link
'depth' => 0, // limit the depth of the nav
'fallback_cb' => 'joints_footer_links_fallback' // fallback function
));
} /* end joints footer link */
// HEADER FALLBACK MENU
function joints_main_nav_fallback() {
wp_page_menu( array(
'show_home' => true,
'menu_class' => '', // adding custom nav class
'include' => '',
'exclude' => '',
'echo' => true,
'link_before' => '', // before each link
'link_after' => '' // after each link
) );
}
// FOOTER FALLBACK MENU
function joints_footer_links_fallback() {
/* you can put a default here if you like */
}
/*********************
SIDEBARS
*********************/
// SIDEBARS AND WIDGETIZED AREAS
function joints_register_sidebars() {
register_sidebar(array(
'id' => 'sidebar1',
'name' => __('Sidebar 1', 'jointstheme'),
'description' => __('The first (primary) sidebar.', 'jointstheme'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'offcanvas',
'name' => __('Offcanvas', 'jointstheme'),
'description' => __('The offcanvas sidebar.', 'jointstheme'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
/*
to add more sidebars or widgetized areas, just copy
and edit the above sidebar code. In order to call
your new sidebar just use the following code:
Just change the name to whatever your new
sidebar's id is, for example:
register_sidebar(array(
'id' => 'sidebar2',
'name' => __('Sidebar 2', 'jointstheme'),
'description' => __('The second (secondary) sidebar.', 'jointstheme'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
To call the sidebar in your template, you can just copy
the sidebar.php file and rename it to your sidebar's name.
So using the above example, it would be:
sidebar-sidebar2.php
*/
} // don't remove this bracket!
/*********************
COMMENT LAYOUT
*********************/
// Comment Layout
function joints_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class('panel'); ?>>
<article id="comment-<?php comment_ID(); ?>" class="clearfix large-12 columns">
<header class="comment-author">
<?php
/*
this is the new responsive optimized comment image. It used the new HTML5 data-attribute to display comment gravatars on larger screens only. What this means is that on larger posts, mobile sites don't have a ton of requests for comment images. This makes load time incredibly fast! If you'd like to change it back, just replace it with the regular wordpress gravatar call:
echo get_avatar($comment,$size='32',$default='<path_to_url>' );
*/
?>
<!-- custom gravatar call -->
<?php
// create variable
$bgauthemail = get_comment_author_email();
?>
<?php printf(__('<cite class="fn">%s</cite>', 'jointstheme'), get_comment_author_link()) ?> on
<time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time(__(' F jS, Y - g:ia', 'jointstheme')); ?> </a></time>
<?php edit_comment_link(__('(Edit)', 'jointstheme'),' ','') ?>
</header>
<?php if ($comment->comment_approved == '0') : ?>
<div class="alert alert-info">
<p><?php _e('Your comment is awaiting moderation.', 'jointstheme') ?></p>
</div>
<?php endif; ?>
<section class="comment_content clearfix">
<?php comment_text() ?>
</section>
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</article>
<!-- </li> is added by WordPress automatically -->
<?php
} // don't remove this bracket!
?>