-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
150 lines (105 loc) · 3.59 KB
/
functions.php
File metadata and controls
150 lines (105 loc) · 3.59 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
<?php
/*********************
LANGUAGE
*********************/
/*********************
SCRIPTS & ENQUEUEING
*********************/
// loading LESS CSS (you'll need this one for the theme to work!)
add_action ('wp_enqueue_scripts','sitestyles');
function sitestyles () {
wp_register_style( 'site-less', get_stylesheet_directory_uri() . '/library/less/style.less', array(), '', 'all' );
wp_enqueue_style( 'site-less' );
}
add_action ('wp_enqueue_scripts','sitescripts');
// loading Flexslider
function sitescripts () {
wp_register_script( 'flexslider', get_stylesheet_directory_uri() . '/library/js/jquery.flexslider.js', array('jquery'), '', 'all' );
wp_register_script( 'site', get_stylesheet_directory_uri() . '/library/js/scripts.js', array('jquery', 'flexslider'), '', 'all' );
wp_enqueue_script( 'site' );
}
/************************
REGISTERING NEW ELEMENTS
************************/
//sidebars
add_action ('widgets_init','sitesidebars');
function sitesidebars () {
register_sidebar (array(
'name' => 'Main Sidebar',
'id' => 'main-sidebar',
'description' => "This is your main sidebar.",
'before_widget' => '<div class="widget %2$s" id="%1$s">',
'after_widget' => '</div></div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3><div class="widget-content">'
));
register_sidebar (array(
'name' => 'Sidebar Footer',
'id' => 'sidebar-footer',
'description' => "This is the footer sidebar. It will show up at the bottom of the page.",
'before_widget' => '<div class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
));
}
//menus
add_action ('init','sitemenus');
function sitemenus () {
register_nav_menu( 'header', 'Header Menu' );
register_nav_menu( 'footer', 'Footer Menu' );
}
// taxonomy
// featured images sizes
add_theme_support( 'post-thumbnails' );
/* add_image_size( 'full-width', 750, 350, true ); */
// custom post types
/*
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'custom-name',
array(
'labels' => array(
'name' => 'Name' ,
'singular_name' => 'SingularName' ,
'add_new' => 'Add New' ,
'add_new_item' => 'Add New Name' ,
'edit_item' => 'Edit Name' ,
'new_item' => 'New Name' ,
'view_item' => 'View Name' ,
'search_items' => 'Search Names' ,
'not_found' => 'No Names Found' ,
'not_found_in_trash' => 'There Are No Names in the Trash'
),
'description' => 'Custom post type description.',
'public' => true,
'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail', 'page-attributes', ),
)
);
}
*/
/********************
OTHER
********************/
// removes 10px off bug in Caption images
add_filter('img_caption_shortcode', 'my_img_caption_shortcode_filter',10,3);
function my_img_caption_shortcode_filter($val, $attr, $content = null)
{
extract(shortcode_atts(array(
'id' => '',
'align' => 'aligncenter',
'width' => '',
'caption' => ''
), $attr));
if ( 1 > (int) $width || empty($caption) )
return $val;
$capid = '';
if ( $id ) {
$id = esc_attr($id);
$capid = 'id="figcaption_'. $id . '" ';
$id = 'id="' . $id . '" aria-labelledby="figcaption_' . $id . '" ';
}
return '<figure ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: '
. (int) $width . 'px">' . do_shortcode( $content ) . '<figcaption ' . $capid
. 'class="wp-caption-text">' . $caption . '</figcaption></figure>';
}