This repository was archived by the owner on Nov 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfunctions.php
More file actions
169 lines (137 loc) · 4.87 KB
/
functions.php
File metadata and controls
169 lines (137 loc) · 4.87 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
// Start Genesis
include_once( get_template_directory() . '/lib/init.php' );
include_once( get_stylesheet_directory() . '/includes/class-widgets.php' );
// Set Child Theme info
define( 'CHILD_THEME_VERSION', '1.1.0' );
define( 'CHILD_THEME_NAME', 'SpringClean' );
// Add Theme Supports
add_theme_support( 'html5' );
add_theme_support( 'genesis-responsive-viewport' );
add_theme_support( 'post-formats', array( 'image', 'link', 'quote', 'video' ) );
add_theme_support( 'genesis-footer-widgets', 1 );
// Remove Theme Supports
remove_theme_support( 'genesis-menus' );
// Remove unsupported layouts
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
// Remove unsupported sidebars
unregister_sidebar( 'sidebar' );
unregister_sidebar( 'sidebar-alt' );
// Actions
add_action( 'wp_enqueue_scripts', 'springclean_nq' );
add_action( 'genesis_entry_content', 'springclean_post_format_icons', 9 );
add_action( 'genesis_before_entry_content', 'springclean_tumblog_post_content' );
add_action( 'genesis_after_entry_content', 'springclean_tumblog_link', 5 );
add_action( 'widgets_init', 'springclean_widgets' );
remove_action( 'wp_head', 'genesis_load_favicon' );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
// Filters
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
add_filter( 'genesis_post_info', 'springclean_post_info' );
add_filter( 'genesis_footer_backtotop_text', '__return_empty_string' );
add_filter( 'genesis_footer_creds_text', 'springclean_footer_creds' );
/**
* Modify the Post Info section
*
* @param string $info
* @return string
* @since 1.0.0
*/
function springclean_post_info( $info ) {
$info = '[post_date format="F jS"] [post_edit before=" | "]';
return $info;
}
/**
* Enqueue Scripts and Styles necessary for the theme
*
* @since 1.0.0
*/
function springclean_nq() {
// Include Font Awesome
wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', false, '4.0.3' );
// Include Google Fonts
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Oxygen|Bitter', false, $CHILD_THEME_VERSION );
// Include our JS file
wp_enqueue_script( 'springclean-js', get_stylesheet_directory_uri() . '/includes/js/script.js', array( 'jquery' ), $CHILD_THEME_VERSION );
}
/**
* Modify the footer credit text
*
* @param string $creds
* @return string
*
* @since 1.0.0
* @version 1.1.0
*/
function springclean_footer_creds( $creds ) {
$creds = '<p>[footer_copyright] <a href="' . home_url() . '">' . get_bloginfo( 'name' ) . '</a> • Designed by <a href="http://arconixpc.com">Arconix Computers</a> • [footer_loginout]</p>';
return $creds;
}
/**
* Set up Post Format Font Awesome icons
*
* @since 1.0.0
* @return return early if we're on a page
*/
function springclean_post_format_icons() {
if ( is_page() )
return;
$format = get_post_format();
$url = home_url();
switch( $format ) {
case '': // Standard posts (WP returns an empty string for the format)
case 'standard': // For when WP finally fixes the format bug
echo '<a class="fa fa-lg fa-file-o" href="' . $url . '/type/' . $format . '"></a>';
break;
case 'image':
echo '<a class="fa fa-lg fa-picture-o" href="' . $url . '/type/' . $format . '"></a>';
break;
case 'link':
echo '<a class="fa fa-lg fa-link" href="' . $url . '/type/' . $format . '"></a>';
break;
case 'quote':
echo '<a class="fa fa-lg fa-quote-left" href="' . $url . '/type/' . $format . '"></a>';
break;
case 'video':
echo '<a class="fa fa-lg fa-youtube-play" href="' . $url . '/type/' . $format . '"></a>';
break;
default:
echo '<!-- ' . $format . '-->';
break;
}
}
/**
* Output WooTumblog Content
*
* @since 1.0.0
*/
function springclean_tumblog_post_content() {
if ( function_exists( 'woo_tumblog_content' ) )
woo_tumblog_content( $return = false );
}
/**
* Add the link URL below the entry content
*
* @return null return early if it's not a link format and woo_tumblog doesn't exist
* @since 1.0.0
*/
function springclean_tumblog_link() {
$format = get_post_format();
if( $format != "link" )
return;
$url = esc_url( get_post_meta( get_the_id(), 'link-url', true ) );
$r = '<div class="link-wrap"><a class="external" href="' . $url . '">Continue to Full Article</a></div>';
echo $r;
}
/**
* Registers the theme's widget
*
* @since 1.1.0
*/
function springclean_widgets() {
register_widget( 'SpringClean_Social_Widget' );
}