-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathfunctions.php
More file actions
184 lines (164 loc) · 6.67 KB
/
functions.php
File metadata and controls
184 lines (164 loc) · 6.67 KB
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
180
181
182
183
184
<?php
/**
* saybers functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package saybers
*/
if ( ! function_exists( 'saybers_theme_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 saybers_theme_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on saybers, use a find and replace
* to change 'saybers' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'saybers', 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' );
// Title Name Alteration
require get_template_directory( ).'/inc/minor-changes.php';
/*
* 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' );
//set_post_thumbnail_size( 450, 300 );
add_image_size( 'homepage-thumb', 450, 300, true );
add_image_size( 'portfolio-thumb', 800, 600, true );
add_image_size( 'team-thumb', 257, 380, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary', 'saybers' ),
) );
/*
* 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',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'saybers_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 40,
'width' => 40,
'flex-height' => true,
) );
function saybers_custom_excerpt_length( $length ) {
return 23;
}
add_filter( 'excerpt_length', 'saybers_custom_excerpt_length', 999 );
}
endif;
add_action( 'after_setup_theme', 'saybers_theme_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 saybers_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'saybers_content_width', 640 );
}
add_action( 'after_setup_theme', 'saybers_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function saybers_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Footer Left', 'saybers' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'saybers' ),
'before_widget' => '<div class="block side-widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Right', 'saybers' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Add widgets here.', 'saybers' ),
'before_widget' => '<div class="block side-widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Center', 'saybers' ),
'id' => 'sidebar-3',
'description' => esc_html__( 'Add widgets here.', 'saybers' ),
'before_widget' => '<div class="block side-widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'saybers_widgets_init' );
/**
* Registers an editor stylesheet for the theme.
*/
function wpdocs_theme_add_editor_styles() {
add_editor_style( get_stylesheet_uri() );
}
add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' );
function saybers_scripts(){
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_script('jquery');
wp_enqueue_script('saybers-bootstrap', get_template_directory_uri().'/assets/js/bootstrap.min.js');
wp_enqueue_script('saybers-fa','https://kit.fontawesome.com/bd6e0dc686.js', null, null, true );
wp_enqueue_script('saybers-jquery.magnific-popup', get_template_directory_uri().'/assets/js/jquery.magnific-popup.min.js');
wp_enqueue_script('saybers-owl.carousel', get_template_directory_uri().'/assets/js/owl.carousel.js');
wp_enqueue_script('saybers-imagesloaded', get_template_directory_uri().'/assets/js/imagesloaded.min.js');
wp_enqueue_script('saybers-isotope', get_template_directory_uri().'/assets/js/isotope.pkgd.min.js');
wp_enqueue_script('saybers-validator', get_template_directory_uri().'/assets/js/validator.js');
wp_enqueue_script('saybers-contact', get_template_directory_uri().'/assets/js/contact.js');
wp_enqueue_script('saybers-jquery-waypoints', get_template_directory_uri().'/assets/js/jquery.waypoints.js');
wp_enqueue_script('saybers-jquery-counterup', get_template_directory_uri().'/assets/js/jquery.counterup.min.js');
wp_enqueue_script('saybers-scrolltopcontrol', get_template_directory_uri().'/assets/js/scrolltopcontrol.js');
wp_enqueue_script('saybers-main', get_template_directory_uri().'/assets/js/main.js');
}
add_action('wp_enqueue_scripts','saybers_scripts');
// CUSTOM POSTS TYPES
require get_template_directory( ).'/inc/customizer.php';
// TGM plugin activation
require_once get_template_directory( ).'/inc/class-tgm-plugin-activation.php';
require get_template_directory( ).'/inc/install-plugins.php';
// One click demo import
require_once get_template_directory( ).'/inc/demo-imports.php';