-
Notifications
You must be signed in to change notification settings - Fork 226
/
init.php
117 lines (93 loc) · 3.57 KB
/
init.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
<?php
/**
* _mbbasetheme theme init setup
*
* @package _mbbasetheme
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 900; /* pixels */
}
if ( ! function_exists( '_mbbasetheme_setup' ) ) :
/**
* 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 for post thumbnails.
*/
function _mbbasetheme_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on _mbbasetheme, use a find and replace
* to change '_mbbasetheme' to the name of your theme in all the template files
*/
load_theme_textdomain( '_mbbasetheme', get_template_directory() . '/languages' );
// Clean up the head
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'wp_shortlink_wp_head' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
// Register nav menus
register_nav_menus( array(
'primary' => __( 'Primary Menu', '_mbbasetheme' ),
) );
// Register Widget Areas
// Function location: /lib/theme-functions.php
add_action( 'widgets_init', 'mb_widgets_init' );
// Execute shortcodes in widgets
// add_filter('widget_text', 'do_shortcode');
// Add Editor Style
add_editor_style();
// Prevent File Modifications
if ( ! defined( 'DISALLOW_FILE_EDIT' ) ) {
define( 'DISALLOW_FILE_EDIT', true );
}
// Enable support for Post Thumbnails on posts and pages.
add_theme_support( 'post-thumbnails' );
// Add Image Sizes
// add_image_size( $name, $width = 0, $height = 0, $crop = false );
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( '_mbbasetheme_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Remove Dashboard Meta Boxes
// Function location: /lib/theme-functions.php
add_action( 'wp_dashboard_setup', 'mb_remove_dashboard_widgets' );
// Change Admin Menu Order
// Function location: /lib/theme-functions.php
add_filter( 'custom_menu_order', '__return_true' );
add_filter( 'menu_order', 'mb_custom_menu_order' );
// Hide Admin Areas that are not used
// Function location: /lib/theme-functions.php
add_action( 'admin_menu', 'mb_remove_menu_pages' );
// Remove default link for images
// Function location: /lib/theme-functions.php
add_action( 'admin_init', 'mb_imagelink_setup', 10 );
// Enable support for HTML5 markup.
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
) );
// Enable support for Post Formats.
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link',
) );
// Enqueue scripts
// Function location: /lib/theme-functions.php
add_action( 'wp_enqueue_scripts', 'mb_scripts' );
// Remove Query Strings From Static Resources
// Function location: /lib/theme-functions.php
add_filter( 'script_loader_src', 'mb_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', 'mb_remove_script_version', 15, 1 );
// Remove Read More Jump
// Function location: /lib/theme-functions.php
add_filter( 'the_content_more_link', 'mb_remove_more_jump_link' );
}
endif; // _mbbasetheme_setup
add_action( 'after_setup_theme', '_mbbasetheme_setup' );