forked from ivandoric/olympos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
64 lines (51 loc) · 1.84 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
<?php
/* Register Scripts and Style */
function theme_register_scripts() {
wp_enqueue_style( 'olympos-css', get_stylesheet_uri() );
wp_enqueue_script( 'olympos-js', esc_url( trailingslashit( get_template_directory_uri() ) . 'js/olympos.min.js' ), array( 'jquery' ), '1.0', true );
}
add_action( 'wp_enqueue_scripts', 'theme_register_scripts', 1 );
/* Add menu support */
if (function_exists('add_theme_support')) {
add_theme_support('menus');
}
/* Add post image support */
add_theme_support( 'post-thumbnails' );
/* Add custom thumbnail sizes */
if ( function_exists( 'add_image_size' ) ) {
//add_image_size( 'custom-image-size', 500, 500, true );
}
/* Add widget support */
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'SidebarOne',
'id' => 'SidebarOne',
'before_widget' => '<div id="%1$s" class="sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'SidebarTwo',
'id' => 'SidebarTwo',
'before_widget' => '<div id="%1$s" class="sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
/* EXCERPT
Usage:
<?php echo excerpt(100); ?>
*/
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}