forked from WPBuddy/largo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
executable file
·116 lines (103 loc) · 4.9 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
<?php
/**
* Largo functions and definitions
*
* When using a child theme (see http://codex.wordpress.org/Theme_Development and
* http://codex.wordpress.org/Child_Themes), you can override certain functions
* (those wrapped in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before the parent
* theme's file, so the child theme functions would be used.
*
* Functions that are not pluggable (not wrapped in function_exists()) are instead attached
* to a filter or action hook. The hook can be removed by using remove_action() or
* remove_filter() and you can attach your own function to the hook.
*
* We can remove the parent theme's hook only after it is attached, which means we need to
* wait until setting up the child theme:
*
* <code>
* add_action( 'after_setup_theme', 'my_child_theme_setup' );
* function my_child_theme_setup() {
* // We are providing our own filter for excerpt_length (or using the unfiltered value)
* remove_filter( 'excerpt_length', 'eleven_excerpt_length' );
* ...
* }
* </code>
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
*/
/**
* By default we'll assume the site is not for an INN member
* set INN_MEMBER to TRUE to show an INN logo in the header
* and a widget of INN member stories in the homepage sidebar
*/
if ( ! defined( 'INN_MEMBER' ) )
define( 'INN_MEMBER', FALSE );
// Set the content width based on the theme's design and stylesheet.
if ( ! isset( $content_width ) )
$content_width = 771;
// load the options framework (used for our theme options pages)
if ( ! function_exists( 'optionsframework_init' ) ) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/lib/options-framework/' );
require_once dirname( __FILE__ ) . '/lib/options-framework/options-framework.php';
}
// need to include this explicitly to allow us to check if certain plugins are active.
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
/**
* Load up all of the other goodies from the /inc directory
*/
$includes = array(
'/inc/largo-plugin-init.php', // a list of recommended plugins
'/inc/dashboard.php', // custom dashboard widgets
'/inc/robots.php', // default robots.txt config
'/inc/custom-feeds.php', // create custom RSS feeds
'/inc/users.php', // add custom fields for user profiles
'/inc/sidebars.php', // register sidebars
'/inc/widgets.php', // register widgets
'/inc/nav-menus.php', // register nav menus
'/inc/taxonomies.php', // add our custom taxonomies
'/inc/images.php', // setup custom image sizes
'/inc/editor.php', // add tinymce customizations and shortcodes
'/inc/post-meta.php', // add post meta boxes
'/inc/open-graph.php', // add open graph, twittercard and google publisher markup to the header
'/inc/post-tags.php', // add some custom template tags (mostly used in single posts)
'/inc/header-footer.php', // some additional template tags used in the header and footer
'/inc/related-content.php', // functions dealing with related content
'/inc/featured-content.php', // functions dealing with featured content
'/inc/enqueue.php', // enqueue our js and css files
'/inc/post-templates.php', // single post templates
'/inc/post-meta.php' // add post meta boxes
);
// This functionality is probably not for everyone so we'll make it easy to turn it on or off
if ( is_plugin_active('ad-code-manager/ad-code-manager.php') )
$includes[] = '/inc/ad-codes.php'; // register ad codes
if ( of_get_option( 'less_enabled' ) )
$includes[] = '/inc/custom-less-variables.php'; // add UI to alter variables.less
if ( of_get_option( 'custom_landing_enabled' ) )
$includes[] = '/inc/wp-taxonomy-landing/taxonomy-landing.php'; // adds taxonomy landing plugin
// Perform load
foreach ( $includes as $include ) {
require_once( get_template_directory() . $include );
}
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* To override largo_setup() in a child theme, add your own largo_setup() to your child theme's
* functions.php file.
*/
if ( ! function_exists( 'largo_setup' ) ) {
function largo_setup() {
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style('/css/editor-style.css');
// Add default posts and comments RSS feed links to <head>.
add_theme_support( 'automatic-feed-links' );
// Add support for localization (this is a work in progress)
load_theme_textdomain('largo', get_template_directory() . '/lang');
}
}
add_action( 'after_setup_theme', 'largo_setup' );