-
Notifications
You must be signed in to change notification settings - Fork 4
/
functions.php
97 lines (84 loc) · 3.18 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
<?php
define( 'TEMPPATH', get_stylesheet_directory_uri());
define( 'IMAGES', TEMPPATH. "/images");
/**
* Enqueue scripts and styles for the front end.
*/
add_action( 'wp_enqueue_scripts', 'tinytheme_scripts_and_styles_setup' );
function tinytheme_scripts_and_styles_setup() {
// Load the icon font stylesheet
wp_enqueue_style( 'tinytheme-icon-font', get_template_directory_uri() . '/stylesheet/font-awesome.min.css' );
wp_enqueue_style( 'tinytheme-icon-font-ie', get_template_directory_uri() . '/stylesheet/font-awesome-ie7.min.css', array( 'tinytheme-icon-font' ) );
wp_style_add_data( 'tinytheme-icon-font-ie', 'conditional', 'IE 7' );
}
function tiny_setup(){
if ( !isset( $content_width ) ){$content_width = '100%';};
}
add_theme_support('nav-menus');
if ( function_exists('register_nav_menus')) {
register_nav_menus(
array(
'main-menu' => __( 'Primary menu' )
)
);
}
//RSS Support
add_theme_support( 'automatic-feed-links' );
//content limiter function
function content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
//add menu support to theme
//Register Sidebar
function tiny_sidebar(){
register_sidebar( array (
'name' => __( 'Tiny UpperBar', 'tiny_theme' ),
'id' => 'primary-widget-area',
'class' => '',
'description' => __( 'The primary widget area', 'tiny_theme' ),
'before_widget' => '<div class="widget %2$s" id="%1$s" >',
'after_widget' => "</div>",
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action('widgets_init','tiny_sidebar');
//custom comment function
function tiny_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<div <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<div class="comment_content">
<h3><?php comment_author_link(); ?> <span><?php echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ago'; ?> </span></h3>
<?php if ($comment->comment_approved == '0') : ?>
<p class="waiting_approve"><?php _e('Your comment is awaiting moderation.','tiny_thene') ?></p>
<?php comment_text(); ?>
<?php else : ?>
<?php comment_text(); ?>
<?php
comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'])),$comment->comment_ID) ?>
<?php endif; ?>
</div>
<?php }
//comment reply script
function tiny_enqueue_comments_reply() {
if( get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'comment_form_before', 'tiny_enqueue_comments_reply' );
//removes extra 28px margin issue added by admin bar
function my_function_admin_bar(){ return false; }
add_filter( 'show_admin_bar' , 'my_function_admin_bar');
include_once('includes/tiny-options.php');
include_once('includes/shortcodes.php');
include_once('includes/update_notifier.php');