This repository has been archived by the owner on Aug 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
functions.php
152 lines (130 loc) · 4.49 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
149
150
151
152
<?php
/**
* This makes the child theme work. If you need any
* additional features or let's say menus, do it here.
*
* @return void
*/
function required_starter_themesetup() {
load_child_theme_textdomain( 'requiredstarter', get_stylesheet_directory() . '/languages' );
// Register an additional Menu Location
register_nav_menus( array(
'meta' => __( 'Meta Menu', 'requiredstarter' )
) );
// Add support for custom backgrounds and overwrite the parent backgorund color
add_theme_support( 'custom-background', array( 'default-color' => 'f7f7f7' ) );
}
add_action( 'after_setup_theme', 'required_starter_themesetup' );
/**
* With the following function you can disable theme features
* used by the parent theme without breaking anything. Read the
* comments on each and follow the link, if you happen to not
* know what the function is for. Remove the // in front of the
* remove_theme_support('...'); calls to make them execute.
*
* @return void
*/
function required_starter_after_parent_theme_setup() {
/**
* Hack added: 2012-10-04, Silvan Hagen
*
* This is a hack, to calm down PHP Notice, since
* I'm not sure if it's a bug in WordPress or my
* bad I'll leave it here: http://wordpress.org/support/topic/undefined-index-custom_image_header-in-after_setup_theme-of-child-theme
*/
if ( ! isset( $GLOBALS['custom_image_header'] ) )
$GLOBALS['custom_image_header'] = array();
if ( ! isset( $GLOBALS['custom_background'] ) )
$GLOBALS['custom_background'] = array();
// Remove custom header support: http://codex.wordpress.org/Custom_Headers
//remove_theme_support( 'custom-header' );
// Remove support for post formats: http://codex.wordpress.org/Post_Formats
//remove_theme_support( 'post-formats' );
// Remove featured images support: http://codex.wordpress.org/Post_Thumbnails
//remove_theme_support( 'post-thumbnails' );
// Remove custom background support: http://codex.wordpress.org/Custom_Backgrounds
//remove_theme_support( 'custom-background' );
// Remove automatic feed links support: http://codex.wordpress.org/Automatic_Feed_Links
//remove_theme_support( 'automatic-feed-links' );
// Remove editor styles: http://codex.wordpress.org/Editor_Style
//remove_editor_styles();
// Remove a menu from the theme: http://codex.wordpress.org/Navigation_Menus
//unregister_nav_menu( 'secondary' );
}
add_action( 'after_setup_theme', 'required_starter_after_parent_theme_setup', 11 );
/**
* Add our theme specific js file and some Google Fonts
* @return void
*/
function required_starter_scripts() {
/**
* Registers the child-theme.js
*
* Remove if you don't need this file,
* it's empty by default.
*/
wp_enqueue_script(
'child-theme-js',
get_stylesheet_directory_uri() . '/javascripts/child-theme.js',
array( 'theme-js' ),
required_get_theme_version( false ),
true
);
/**
* Registers the app.css
*
* If you don't need it, remove it.
* The file is empty by default.
*/
wp_register_style(
'app-css', //handle
get_stylesheet_directory_uri() . '/stylesheets/app.css',
array( 'foundation-css' ), // needs foundation
required_get_theme_version( false ) //version
);
wp_enqueue_style( 'app-css' );
/**
* Adding google fonts
*
* This is the proper code to add google fonts
* as seen in TwentyTwelve
*/
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array( 'family' => 'Open+Sans:300,600' );
wp_enqueue_style(
'open-sans',
add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ),
array(),
null
);
}
add_action('wp_enqueue_scripts', 'required_starter_scripts');
/**
* Overwrite the default continue reading link
*
* This function is an example on how to overwrite
* the parent theme function to create continue reading
* links.
*
* @return string HTML link with text and permalink to the post/page/cpt
*/
function required_continue_reading_link() {
return ' <a class="read-more" href="'. esc_url( get_permalink() ) . '">' . __( ' Read on! →', 'requiredstarter' ) . '</a>';
}
/**
* Overwrite the defaults of the Orbit shortcode script
*
* Accepts all the parameters from http://foundation.zurb.com/docs/orbit.php#optCode
* to customize the options for the orbit shortcode plugin.
*
* @param array $args default args
* @return array your args
*/
function required_orbit_script_args( $defaults ) {
$args = array(
'animation' => 'fade',
'advanceSpeed' => 8000,
);
return wp_parse_args( $args, $defaults );
}
add_filter( 'req_orbit_script_args', 'required_orbit_script_args' );