-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
executable file
·89 lines (76 loc) · 2.98 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
<?php
/*Set language folder and load textdomain
------------------------------------------------------------ */
if (file_exists(STYLESHEETPATH . '/languages'))
$language_folder = (STYLESHEETPATH . '/languages');
else
$language_folder = (TEMPLATEPATH . '/languages');
load_theme_textdomain('traction', $language_folder);
/*Required functions
------------------------------------------------------------ */
if (is_file(STYLESHEETPATH . '/functions/comments.php'))
require_once(STYLESHEETPATH . '/functions/comments.php');
else
require_once(TEMPLATEPATH . '/functions/comments.php');
if (is_file(STYLESHEETPATH . '/functions/traction-extend.php'))
require_once(STYLESHEETPATH . '/functions/traction-extend.php');
else
require_once(TEMPLATEPATH . '/functions/traction-extend.php');
/*Sidebars
------------------------------------------------------------ */
if ( function_exists('register_sidebar_widget') )
register_sidebar(array(
'name'=> __('Sidebar', 'traction'),
'id' => 'normal_sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar_widget') )
register_sidebar(array(
'name'=> __('Footer Center', 'traction'),
'id' => 'footer_sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar_widget') )
register_sidebar(array(
'name'=> __('Footer Right', 'traction'),
'id' => 'footer_sidebar_2',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
/*Custom excerpt length and more string
------------------------------------------------------------ */
function new_excerpt_length($length) { return 5; }
add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_more($more) { return ''; }
add_filter('excerpt_more', 'new_excerpt_more');
// Remove auto p tags
remove_filter('the_excerpt', 'wpautop');
/*Custom thumbnails
------------------------------------------------------------ */
if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
add_theme_support( 'post-thumbnails' );
add_image_size( 'index-thumb', 175, 150, true );
add_image_size( 'feature-small', 30, 30, true );
add_image_size( 'feature-big', 602, 200, true );
}
/*No more tag jumping
------------------------------------------------------------ */
function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
add_filter('the_content_more_link', 'remove_more_jump_link');