-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
179 lines (145 loc) · 5.92 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
/**
* Functions and definitions
*
* @package blogbasico
*/
if (!function_exists('blogbasico_setup')) {
function blogbasico_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
*/
load_theme_textdomain('blogbasico', get_template_directory().'/languages');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support('post-thumbnails');
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'menu-1' => esc_html__('Main menu', 'blogbasico'),
'menu-2' => esc_html__('Footer menu', 'blogbasico')
));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
));
// Enable support for Post Formats.
add_theme_support('post-formats', array(
'image', 'gallery', 'video', 'audio', 'aside', 'link', 'quote', 'status', 'chat'
));
// Set up the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('blogbasico_custom_background_args', array(
'default-color' => 'f1f1f1',
'default-image' => '',
)) );
// Add theme support for selective refresh for widgets.
add_theme_support('customize-selective-refresh-widgets');
// Add support for core custom logo.
add_theme_support('custom-logo', array(
'height' => 60,
'width' => 60,
'flex-width' => true,
));
}
}
add_action('after_setup_theme', 'blogbasico_setup');
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function blogbasico_content_width() {
$GLOBALS['content_width'] = apply_filters('blogbasico_content_width', 690);
}
add_action('after_setup_theme', 'blogbasico_content_width', 0);
/**
* Enqueue styles.
*/
if (!function_exists('blogbasico_styles')) {
function blogbasico_styles() {
// google fonts
//wp_enqueue_style('google-fonts', '//fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic', array(), '1.0.34');
// bootstrap
wp_enqueue_style('bootstrap', get_template_directory_uri().'/assets/bootstrap/css/bootstrap.min.css', array(), '3.3.7');
wp_enqueue_style('bootstrap-theme', get_template_directory_uri().'/assets/bootstrap/css/bootstrap-theme.min.css', array(), '3.3.7');
// ie10 viewport bug workaround
wp_enqueue_style('ie10-viewport-bug-workaround', get_template_directory_uri().'/assets/css/ie10-viewport-bug-workaround.css', array(), '1.3.16');
// font awesome
wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/font-awesome/css/font-awesome.min.css', array(), '4.7.0');
// main stylesheet
wp_enqueue_style('blogbasico-style', get_stylesheet_directory_uri().'/style.css', array(), '1.0.34');
}
}
add_action('wp_enqueue_scripts', 'blogbasico_styles');
/**
* Enqueue scripts.
*/
if (!function_exists('blogbasico_scripts')) {
function blogbasico_scripts() {
// html5shiv.js (for IE)
wp_enqueue_script('html5shiv', get_template_directory_uri().'/assets/js/html5shiv.min.js', array(), '3.7.3', false);
wp_script_add_data('html5shiv', 'conditional', 'lt IE 9');
// respond.js (for IE)
wp_enqueue_script('respond', get_template_directory_uri().'/assets/js/respond.min.js', array(), '1.4.2', false);
wp_script_add_data('respond', 'conditional', 'lt IE 9');
// bootstrap
wp_enqueue_script('bootstrap', get_template_directory_uri().'/assets/bootstrap/js/bootstrap.min.js', array('jquery'), '3.3.7', true);
// IE10 viewport hack for Surface/desktop Windows 8 bug
wp_enqueue_script('ie10-viewport-bug-workaround', get_template_directory_uri().'/assets/js/ie10-viewport-bug-workaround.js', array(), '1.3.16', true);
// theme js
wp_enqueue_script('blogbasico-theme', get_template_directory_uri().'/assets/js/theme.js', array('jquery'), '1.0.34', true);
// comments
if ( is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
}
add_action('wp_enqueue_scripts', 'blogbasico_scripts');
/**
* Custom template widgets for this theme.
*/
require_once get_template_directory().'/inc/template-widgets.php';
/**
* Custom template comments for this theme.
*/
require_once get_template_directory().'/inc/template-comments.php';
/**
* Custom template tags for this theme.
*/
require_once get_template_directory().'/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require_once get_template_directory().'/inc/template-functions.php';
//remover titulo
add_filter( 'document_title_parts', function( $title )
{
if ( is_home() || is_front_page() )
unset( $title['title'] ); /** Remove title name */
if ( is_single() )
unset( $title['site'] ); /** Remove site name */
return $title;
}, 10, 1 );
/**
* Customizer additions.
*/
require_once get_template_directory().'/inc/customizer.php';
require_once get_template_directory().'/inc/sanitize.php';
require_once get_template_directory().'/inc/inline-styles.php';