forked from billerickson/Genesis-CRM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
136 lines (107 loc) · 3.23 KB
/
index.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
<?php
/**
* Index - Used for everything but page templates
*
* @package genesis-crm
* @author Bill Erickson <[email protected]>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
/**
* Loop Setup
*
* This setup function attaches all of the loop-specific functions
* to the correct hooks and filters. All the functions themselves
* are defined below this setup function.
*
*/
add_action('genesis_before', 'be_loop_setup');
function be_loop_setup() {
// Customize Post Info and Meta
remove_action('genesis_before_post_content', 'genesis_post_info');
remove_action('genesis_after_post_content', 'genesis_post_meta');
add_action('genesis_before_post_title', 'genesis_post_info');
add_filter('genesis_post_info', 'be_post_info');
// Post Title clicks to edit link
add_filter('genesis_post_title_output', 'be_post_title');
// Customize Post Content
remove_action('genesis_post_content', 'genesis_do_post_content');
add_action('genesis_post_content', 'be_post_content');
// Post Classes
add_filter('post_class', 'be_post_class');
// Archive Title
add_action('genesis_before_loop', 'be_archive_title');
}
/**
* Customize Post Info
*
* @author Bill Erickson
* @link http://dev.studiopress.com/shortcode-reference
* @param string, original post info
* @return string, modified post info
*/
function be_post_info($post_info) {
$post_info = '[post_categories before=""]';
return $post_info;
}
/**
* Customize Post Titles.
* @uses be_get_project_name() for Title
* @uses get_edit_post_link() for Permalink
*
* @author Bill Erickson
* @param string, original title output
* @return string, modified title output
*/
function be_post_title($title) {
$title = be_get_project_name();
if ( strlen( $title ) == 0 )
return;
if ( is_singular() ) {
$title = sprintf( '<h1 class="entry-title">%s</h1>', apply_filters( 'genesis_post_title_text', $title ) );
} else {
$title = sprintf( '<h2 class="entry-title"><a href="%s" title="%s" rel="bookmark">%s</a></h2>', get_edit_post_link(), the_title_attribute('echo=0'), apply_filters( 'genesis_post_title_text', $title ) );
}
return $title;
}
/**
* Customize Post Content
*
* @author Bill Erickson
*/
include_once( 'lib/functions/post-content.php');
/**
* Post Classes
*
* @author Bill Erickson
* @link http://codex.wordpress.org/Function_Reference/post_class#Add_Classes_By_Filters
* @param array, original post classes
* @return array, modified post classes
*/
function be_post_class($classes){
if (in_category('active-project')) {
global $prefix;
$work = get_custom_field($prefix.'needs_work');
if (empty($work)) $work = 'yes';
$classes[] = 'work-'.$work;
}
global $loop_counter;
$classes[] = 'one-third';
if ($loop_counter % 3 == 0) $classes[] = 'first';
return $classes;
}
/**
* Archive Title
*
* @author Bill Erickson
*/
function be_archive_title() {
if ( is_search() ) $title = 'Search Results for <em>'. get_query_var('s') . '</em>';
if ( is_category() ) $title = 'Category Results for <em>'. get_query_var('category_name') . '</em>';
if ( isset($title) ) {
printf( '<div class="taxonomy-description">%s</div>', $title );
}
}
genesis();
?>