-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
222 lines (160 loc) · 7.11 KB
/
functions.php
File metadata and controls
222 lines (160 loc) · 7.11 KB
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
/* Edited by NuevaWeb to make it simpler */
/*
Author: Eddie Machado
URL: htp://themble.com/bones/
This is where you can drop your custom functions or
just edit things like thumbnail sizes, header images,
sidebars, comments, ect.
*/
/************* INCLUDE NEEDED FILES ***************/
require_once( 'lib/ftscratch-support/admin.php' );
require_once( 'lib/ftscratch-support/theme_support.php' );
// =======================================================
// Style & Javascript Enqueue
// =======================================================
function nw_enqueue_scripts(){
wp_enqueue_style( 'nw_style', get_template_directory_uri(). '/css/style.css' );
wp_enqueue_script( "jquery" );
// wp_enqueue_script( 'bootstrap-scripts', get_template_directory_uri(). '/lib/bootstrap-3.3.1/dist/js/bootstrap.min.js', [], '3.3.1', true );
// wp_enqueue_script( 'nw-scripts', get_template_directory_uri(). '/js/scripts.js' );
}
add_action( 'wp_enqueue_scripts', 'nw_enqueue_scripts');
// Hero Unit (hero-unit.php)
// require_once( 'lib/ftscratch-support/custom-post-type/hero-unit-post-type.php' ); // you can disable this if you like
/*
Create your own Post Type:
*/
// require_once( 'lib/ftscratch-support/custom-post-type/custom-post-type.php' ); // you can disable this if you like
/*
Create your own button WordPress Editor Buttons:
*/
//require_once('lib/ftscratch-support/nw-shortcodes/wptuts-editor-buttons/wptuts.php'); // you can disable this if you like
/************* THUMBNAIL SIZE OPTIONS *************/
// Thumbnail sizes
// add_image_size( 'slide-1500-500', 1500, 500, true );
add_image_size( 'slide-1920-460', 1920, 460, true ); // default fullwith carousel slide
add_image_size( 'bg-thumbnail', 640, 480, true );
add_image_size( 'md-thumbnail', 360, 270, true );
add_image_size( 'sm-thumbnail', 203, 152, true );
/*
to add more sizes, simply copy a line from above
and change the dimensions & name. As long as you
upload a "featured image" as large as the biggest
set width or height, all the other sizes will be
auto-cropped.
To call a different size, simply change the text
inside the thumbnail function.
For example, to call the 300 x 300 sized image,
we would use the function:
<?php the_post_thumbnail( 'bones-thumb-300' ); ?>
for the 600 x 100 image:
<?php the_post_thumbnail( 'bones-thumb-600' ); ?>
You can change the names and dimensions to whatever
you like. Enjoy!
*/
add_filter( 'image_size_names_choose', 'bones_custom_image_sizes' );
function bones_custom_image_sizes( $sizes ) {
return array_merge( $sizes, array(
'bg-thumbnail' => __('640px by 480px'),
// 'md-thumbnail' => __('360px by 270px'),
// 'sm-thumbnail' => __('203px by 152px'),
) );
}
/*
The function above adds the ability to use the dropdown menu to select
the new images sizes you have just created from within the media manager
when you add media to your content blocks. If you add more image sizes,
duplicate one of the lines in the array and name it according to your
new image size.
*/
/************* ACTIVE SIDEBARS ********************/
// Sidebars & Widgetizes Areas
function nw_register_sidebars() {
// DOCS: http://codex.wordpress.org/Function_Reference/dynamic_sidebar
register_sidebar(array(
'id' => 'sidebar1', // Change the id
'name' => 'Sidebar 1', // Change the name
'description' => 'The first (primary) sidebar.',
'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' => 'sidebar2', // Change the id
// 'name' => 'Sidebar 2', // Change the name
// 'description' => 'The first (primary) sidebar.', // Better change description too!
// 'before_widget' => '<div id="%1$s" class="widget %2$s">',
// 'after_widget' => '</div>',
// 'before_title' => '<h4 class="widgettitle">',
// 'after_title' => '</h4>',
// ));
} // don't remove this bracket!
/************* COMMENT LAYOUT *********************/
// Comment Layout
function bones_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?>>
<article id="comment-<?php comment_ID(); ?>" class="clearfix">
<header class="comment-author vcard">
<?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>' );
*/
?>
<?php // custom gravatar call ?>
<?php
// create variable
$bgauthemail = get_comment_author_email();
?>
<img data-gravatar="http://www.gravatar.com/avatar/<?php echo md5( $bgauthemail ); ?>?s=32" class="load-gravatar avatar avatar-48 photo" height="32" width="32" src="<?php echo get_template_directory_uri(); ?>/library/images/nothing.gif" />
<?php // end custom gravatar call ?>
<?php printf(__( '<cite class="fn">%s</cite>', 'bonestheme' ), get_comment_author_link()) ?>
<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', 'bonestheme' )); ?> </a></time>
<?php edit_comment_link(__( '(Edit)', 'bonestheme' ),' ','') ?>
</header>
<?php if ($comment->comment_approved == '0') : ?>
<div class="alert alert-info">
<p><?php _e( 'Your comment is awaiting moderation.', 'bonestheme' ) ?></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>
<?php // </li> is added by WordPress automatically ?>
<?php
} // don't remove this bracket!
/************* SEARCH FORM LAYOUT *****************/
// ====================================
// Custom Support
// ====================================
// -----------------------------------
// Add Page attribute "Page Order" to Posts.
// -----------------------------------
// add_action( 'admin_init', 'posts_order_wpse_91866' );
// function posts_order_wpse_91866()
// {
// add_post_type_support( 'post', 'page-attributes' );
// }
// -----------------------------------
// Add Post attribute to Page.
// -----------------------------------
// // Exceprt
// add_action( 'admin_init', 'nw_page_excerpt_init' );
// function nw_page_excerpt_init() {
// add_post_type_support( 'page', 'excerpt' );
// }
// -----------------------------------
// Add Tag Support to Pages
// -----------------------------------
// function tags_support_all() {
// register_taxonomy_for_object_type('post_tag', 'page');
// }
//*************************** Widgets Import *************************** //
// require_once( 'widget/widget-custom-link.php' ); // Agrega un custom url, icon o imagen.
// require_once( 'widget/widget-post-type-feed.php' ); // Agrega un custom url, icon o imagen.
?>