forked from luis-teixeira/bootstrakers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
148 lines (109 loc) · 4.77 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
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
<?php
/**
* Theme AUX
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
* @package WordPress
* @subpackage Starkers
* @since Starkers 4.0
*
* ===================================================================================================================== */
define("TEMPLATE_DEBUGER", TRUE);
/**
* Starkers functions and definitions
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
* @package WordPress
* @subpackage Starkers
* @since Starkers 4.0
*/
/* ========================================================================================================================
Required external files
======================================================================================================================== */
require_once( 'external/starkers-utilities.php' );
/* ========================================================================================================================
Theme specific settings
Uncomment register_nav_menus to enable a single menu with the title of "Primary Navigation" in your theme
======================================================================================================================== */
add_theme_support('post-thumbnails');
// register_nav_menus(array('primary' => 'Primary Navigation'));
/* ========================================================================================================================
Actions and Filters
======================================================================================================================== */
add_action( 'wp_enqueue_scripts', 'starkers_script_enqueuer' );
add_filter( 'body_class', array( 'Starkers_Utilities', 'add_slug_to_body_class' ) );
/* ========================================================================================================================
Custom Post Types - include custom post types and taxonimies here e.g.
e.g. require_once( 'custom-post-types/your-custom-post-type.php' );
======================================================================================================================== */
/* ========================================================================================================================
Scripts
======================================================================================================================== */
/**
* Add scripts via wp_head()
*
* @return void
* @author Keir Whitaker
*/
function starkers_script_enqueuer() {
wp_register_script( 'site', get_template_directory_uri().'/js/site-min.js', array( 'jquery' ) );
wp_enqueue_script( 'site' );
wp_register_style( 'screen', get_stylesheet_directory_uri().'/css/main-min.css', '', '', 'screen' );
wp_enqueue_style( 'screen' );
}
/* ========================================================================================================================
Comments
======================================================================================================================== */
/**
* Custom callback for outputting comments
*
* @return void
* @author Keir Whitaker
*/
function starkers_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
?>
<?php if ( $comment->comment_approved == '1' ): ?>
<li>
<article id="comment-<?php comment_ID() ?>">
<?php echo get_avatar( $comment ); ?>
<h4><?php comment_author_link() ?></h4>
<time><a href="#comment-<?php comment_ID() ?>" pubdate><?php comment_date() ?> at <?php comment_time() ?></a></time>
<?php comment_text() ?>
</article>
<?php endif;
}
/**
* Template AUX function
*
* @author Luis Teixeira
*
**/
function pr( $a ) {
print( '<pre class="dump">' );
print_r( $a );
print( '</pre>' );
}
function nfo($file){
//echo file_get_contents($file);
global $nfo;
if (!defined('TEMPLATE_DEBUGER') || !TEMPLATE_DEBUGER) {
return;
}
$html = file_get_contents($file);
$nfo = '';
$nfo .= "<!-- ----------------------------------------------------------------------------------- -->\n";
$nfo .= "<!-- -->\n";
$nfo .= sprintf("<!-- File: %-60s -->\n", basename($file));
if(preg_match('@Templ'.'ate Name: (.+)@', $html, $m)){
$nfo .= sprintf("<!-- Templ"."ate Name: %-60s -->\n", $m[1]);
}
$nfo .= "<!-- -->\n";
$nfo .= "<!-- ----------------------------------------------------------------------------------- -->\n";
}
function print_nfo(){
global $nfo;
if(isset($nfo) && !empty($nfo)) echo $nfo;
}