-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfunctions.php
executable file
·90 lines (70 loc) · 2.31 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
<?php
/************************************
* Author: MANSON David
* URL: http://www.david-manson.com
************************************/
/*********************
THEME INIT
*********************/
function theme_init() {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links');
add_theme_support( 'menus' );
add_theme_support( 'title-tag' );
// Enable support for HTML5 markup.
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form'
) );
}
add_action( 'after_setup_theme', 'theme_init' );
/************************************
Oembed size option
*************************************/
if ( ! isset( $content_width ) ) {
$content_width = 680;
}
/************************************
Menu
*************************************/
register_nav_menus(array(
'main-nav' => __( 'The Main Menu', 'monsieurpress' ),
'footer-links' => __( 'Footer Links', 'monsieurpress' )
));
/************************************
Sidebar
*************************************/
function theme_sidebars() {
register_sidebar(array(
'id' => 'main-sidebar',
'name' => __( 'Main sidebar', 'monsieurpress' ),
'description' => __( 'The main sidebar', 'monsieurpress' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<div class="widgettitle">',
'after_title' => '</div>'
));
}
add_action( 'widgets_init', 'theme_sidebars' );
/************************************
Apply theme's stylesheet to the visual editor.
*************************************/
function theme_add_editor_styles() {
add_editor_style( get_stylesheet_uri() );
}
add_action( 'init', 'theme_add_editor_styles' );
/************************************
Assets
*************************************/
function front_assets_load() {
if (is_admin()) return;
/* Enqueue theme script & style */
wp_enqueue_style( 'monsieurpress-stylesheet', get_stylesheet_uri() );
wp_enqueue_script( 'monsieurpress-js', get_template_directory_uri() . '/assets/javascript/dist/scripts.js', array('jquery'));
/* Enqueue comment-reply script if needed */
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action('wp_enqueue_scripts', 'front_assets_load');