This repository was archived by the owner on Feb 4, 2025. It is now read-only.
forked from studiopress/genesis-sample
-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·121 lines (90 loc) · 4.01 KB
/
functions.php
File metadata and controls
executable file
·121 lines (90 loc) · 4.01 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
<?php
/**
* Genesis Sample.
*
* This file adds functions to the Genesis Sample Theme.
*
* @package Genesis Sample
* @author StudioPress
* @license GPL-2.0+
* @link http://www.studiopress.com/
*/
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Setup Theme
include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );
//* Set Localization (do not remove)
load_child_theme_textdomain( 'genesis-sample', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'genesis-sample' ) );
//* Add Image upload and Color select to WordPress Theme Customizer
require_once( get_stylesheet_directory() . '/lib/customize.php' );
//* Include Customizer CSS
include_once( get_stylesheet_directory() . '/lib/output.php' );
//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', 'Genesis Sample Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.2.3' );
//* Enqueue Scripts and Styles
add_action( 'wp_enqueue_scripts', 'genesis_sample_enqueue_scripts_styles' );
function genesis_sample_enqueue_scripts_styles() {
wp_enqueue_style( 'genesis-sample-fonts', '//fonts.googleapis.com/css?family=Lato:300,400,700,900', array(), CHILD_THEME_VERSION );
wp_enqueue_style( 'dashicons' );
//* Remove default stylesheet
wp_deregister_style( 'genesis-sample-theme' );
//* Add compiled stylesheet
wp_register_style( 'genesis-sample-theme', get_stylesheet_directory_uri() . '/style.css', array(), CHILD_THEME_VERSION );
wp_enqueue_style( 'genesis-sample-theme' );
wp_enqueue_script( 'genesis-sample-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0', true );
$output = array(
'mainMenu' => __( 'Menu', 'genesis-sample' ),
'subMenu' => __( 'Menu', 'genesis-sample' ),
);
wp_localize_script( 'genesis-sample-responsive-menu', 'genesisSampleL10n', $output );
//* Add compiled JS
wp_enqueue_script( 'genesis-sample-scripts', get_stylesheet_directory_uri() . '/js/script.js', array(), CHILD_THEME_VERSION, true );
}
//* Add HTML5 markup structure
add_theme_support( 'html5', array( 'caption', 'comment-form', 'comment-list', 'gallery', 'search-form' ) );
//* Add Accessibility support
add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
//* Add support for custom header
add_theme_support( 'custom-header', array(
'width' => 600,
'height' => 160,
'header-selector' => '.site-title a',
'header-text' => false,
'flex-height' => true,
) );
//* Add support for custom background
add_theme_support( 'custom-background' );
//* Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
//* Add Image Sizes
add_image_size( 'featured-image', 680, 400, TRUE );
//* Rename primary and secondary navigation menus
add_theme_support( 'genesis-menus' , array( 'primary' => __( 'After Header Menu', 'genesis-sample' ), 'secondary' => __( 'Footer Menu', 'genesis-sample' ) ) );
//* Reposition the secondary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_footer', 'genesis_do_subnav', 5 );
//* Reduce the secondary navigation menu to one level depth
add_filter( 'wp_nav_menu_args', 'genesis_sample_secondary_menu_args' );
function genesis_sample_secondary_menu_args( $args ) {
if ( 'secondary' != $args['theme_location'] ) {
return $args;
}
$args['depth'] = 1;
return $args;
}
//* Add SVG definitions to <head>.
add_action( 'wp_head', 'genesis_sample_include_svg_icons', 999 );
function genesis_sample_include_svg_icons() {
// Define SVG sprite file.
$svg_icons = get_template_directory() . 'images/svg-icons.svg';
// If it exsists, include it.
if ( file_exists( $svg_icons ) ) {
require_once( $svg_icons );
}
}