-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.php
121 lines (98 loc) · 4.29 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
<?php
/**
* Spacious functions related to defining constants, adding files and WordPress core functionality.
*
* Defining some constants, loading all the required files and Adding some core functionality.
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses register_nav_menu() To add support for navigation menu.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @package ThemeGrill
* @subpackage Spacious
* @since Spacious 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 700;
add_action( 'after_setup_theme', 'spacious_setup' );
/**
* All setup functionalities.
*
* @since 1.0
*/
if( !function_exists( 'spacious_setup' ) ) :
function spacious_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
*/
load_theme_textdomain( 'spacious', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page.
add_theme_support( 'post-thumbnails' );
// Registering navigation menus.
register_nav_menus( array(
'primary' => 'Primary Menu',
'footer' => 'Footer Menu'
) );
// Cropping the images to different sizes to be used in the theme
add_image_size( 'featured-blog-large', 750, 350, true );
add_image_size( 'featured-blog-medium', 270, 270, true );
add_image_size( 'featured', 642, 300, true );
add_image_size( 'featured-blog-medium-small', 230, 230, true );
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'spacious_custom_background_args', array(
'default-color' => 'eaeaea'
) ) );
// Adding excerpt option box for pages as well
add_post_type_support( 'page', 'excerpt' );
}
endif;
/**
* Define Directory Location Constants
*/
define( 'SPACIOUS_PARENT_DIR', get_template_directory() );
define( 'SPACIOUS_CHILD_DIR', get_stylesheet_directory() );
define( 'SPACIOUS_IMAGES_DIR', SPACIOUS_PARENT_DIR . '/images' );
define( 'SPACIOUS_INCLUDES_DIR', SPACIOUS_PARENT_DIR. '/inc' );
define( 'SPACIOUS_CSS_DIR', SPACIOUS_PARENT_DIR . '/css' );
define( 'SPACIOUS_JS_DIR', SPACIOUS_PARENT_DIR . '/js' );
define( 'SPACIOUS_LANGUAGES_DIR', SPACIOUS_PARENT_DIR . '/languages' );
define( 'SPACIOUS_ADMIN_DIR', SPACIOUS_INCLUDES_DIR . '/admin' );
define( 'SPACIOUS_WIDGETS_DIR', SPACIOUS_INCLUDES_DIR . '/widgets' );
define( 'SPACIOUS_ADMIN_IMAGES_DIR', SPACIOUS_ADMIN_DIR . '/images' );
define( 'SPACIOUS_ADMIN_JS_DIR', SPACIOUS_ADMIN_DIR . '/js' );
define( 'SPACIOUS_ADMIN_CSS_DIR', SPACIOUS_ADMIN_DIR . '/css' );
/**
* Define URL Location Constants
*/
define( 'SPACIOUS_PARENT_URL', get_template_directory_uri() );
define( 'SPACIOUS_CHILD_URL', get_stylesheet_directory_uri() );
define( 'SPACIOUS_IMAGES_URL', SPACIOUS_PARENT_URL . '/images' );
define( 'SPACIOUS_INCLUDES_URL', SPACIOUS_PARENT_URL. '/inc' );
define( 'SPACIOUS_CSS_URL', SPACIOUS_PARENT_URL . '/css' );
define( 'SPACIOUS_JS_URL', SPACIOUS_PARENT_URL . '/js' );
define( 'SPACIOUS_LANGUAGES_URL', SPACIOUS_PARENT_URL . '/languages' );
define( 'SPACIOUS_ADMIN_URL', SPACIOUS_INCLUDES_URL . '/admin' );
define( 'SPACIOUS_WIDGETS_URL', SPACIOUS_INCLUDES_URL . '/widgets' );
define( 'SPACIOUS_ADMIN_IMAGES_URL', SPACIOUS_ADMIN_URL . '/images' );
define( 'SPACIOUS_ADMIN_JS_URL', SPACIOUS_ADMIN_URL . '/js' );
define( 'SPACIOUS_ADMIN_CSS_URL', SPACIOUS_ADMIN_URL . '/css' );
/** Load functions */
require_once( SPACIOUS_INCLUDES_DIR . '/custom-header.php' );
require_once( SPACIOUS_INCLUDES_DIR . '/functions.php' );
require_once( SPACIOUS_INCLUDES_DIR . '/header-functions.php' );
require_once( SPACIOUS_ADMIN_DIR . '/meta-boxes.php' );
/** Load Widgets and Widgetized Area */
require_once( SPACIOUS_WIDGETS_DIR . '/widgets.php' );
/**
* Adds support for a theme option.
*/
if ( !function_exists( 'optionsframework_init' ) ) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/admin/options/' );
require_once( SPACIOUS_ADMIN_DIR . '/options/options-framework.php' );
}
?>