Completed
Push — master ( 3ee803...e99530 )
by Md. Mozahidur
03:31
created

functions.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Lighthouse functions and definitions.
4
 *
5
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
6
 *
7
 * @package Lighthouse
8
 */
9
10
if ( ! function_exists( 'lighthouse_setup' ) ) :
11
/**
12
 * Sets up theme defaults and registers support for various WordPress features.
13
 *
14
 * Note that this function is hooked into the after_setup_theme hook, which
15
 * runs before the init hook. The init hook is too late for some features, such
16
 * as indicating support for post thumbnails.
17
 */
18
function lighthouse_setup() {
19
    // This theme styles the visual editor to resemble the theme style.
20
	$font_url = 'https://fonts.googleapis.com/css?family=Questrial';
21
	add_editor_style( 
22
		array( 
23
			'style.css', str_replace( ',', '%2C', $font_url )
24
			) 
25
		);
26
	/*
27
	 * Make theme available for translation.
28
	 * Translations can be filed in the /languages/ directory.
29
	 * If you're building a theme based on Lighthouse, use a find and replace
30
	 * to change 'lighthouse' to the name of your theme in all the template files.
31
	 */
32
	load_theme_textdomain( 'lighthouse', get_template_directory() . '/languages' );
33
34
	// Add default posts and comments RSS feed links to head.
35
	add_theme_support( 'automatic-feed-links' );
36
37
	/*
38
	 * Let WordPress manage the document title.
39
	 * By adding theme support, we declare that this theme does not use a
40
	 * hard-coded <title> tag in the document head, and expect WordPress to
41
	 * provide it for us.
42
	 */
43
	add_theme_support( 'title-tag' );
44
45
	/*
46
	 * Enable support for Post Thumbnails on posts and pages.
47
	 *
48
	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
49
	 */
50
	add_theme_support( 'post-thumbnails' );
51
52
	add_image_size( 'lighthouse_feature_img', 1000, 310, array( 'center', 'center' ) );
53
54
	add_image_size( 'lighthouse_blog_listing', 714, 274, array( 'center', 'center' ) );
55
56
	add_image_size( 'lighthouse_related_post', 475, 280, array( 'center', 'center' ) );
57
58
	/*
59
	 * Default HTML5 Form
60
	 *
61
	 * @link https://codex.wordpress.org/Function_Reference/get_search_form
62
	 */
63
	add_theme_support( 'html5', array( 'search-form' ) ); 
64
65
	// This theme uses wp_nav_menu() in one location.
66
	register_nav_menus( array(
67
		'primary' => esc_html__( 'Primary', 'lighthouse' ),
68
		) );
69
70
	/*
71
	 * Switch default core markup for search form, comment form, and comments
72
	 * to output valid HTML5.
73
	 */
74
	add_theme_support( 'html5', array(
75
		'search-form',
76
		'comment-form',
77
		'comment-list',
78
		'gallery',
79
		'caption',
80
		) );
81
82
	/*
83
	 * Enable support for Post Formats.
84
	 * See https://developer.wordpress.org/themes/functionality/post-formats/
85
	 */
86
	add_theme_support( 'post-formats', array(
87
		'aside',
88
		'image',
89
		'video',
90
		'quote',
91
		'link',
92
		) );
93
94
	// Set up the WordPress core custom background feature.
95
	add_theme_support( 'custom-background', apply_filters( 'lighthouse_custom_background_args', array(
96
		'default-color' => 'ffffff',
97
		'default-image' => '',
98
		) ) );
99
}
100
endif;
101
add_action( 'after_setup_theme', 'lighthouse_setup' );
102
103
/**
104
 * Set the content width in pixels, based on the theme's design and stylesheet.
105
 *
106
 * Priority 0 to make it available to lower priority callbacks.
107
 *
108
 * @global int $content_width
109
 */
110
function lighthouse_content_width() {
111
	$GLOBALS['content_width'] = apply_filters( 'lighthouse_content_width', 640 );
112
}
113
add_action( 'after_setup_theme', 'lighthouse_content_width', 0 );
114
115
/**
116
 * Enqueue scripts and styles.
117
 */
118
function lighthouse_scripts() {
119
120
	wp_enqueue_style( 'lighthouse-style', get_stylesheet_uri() );
121
122
	wp_enqueue_style('lighthouse-google-fonts', 'https://fonts.googleapis.com/css?family=Questrial');
123
124
	//wp_enqueue_style('lighthouse-owl-carousel-css', get_template_directory_uri() . '/css/owl.carousel.css');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
125
126
	wp_enqueue_script( 'lighthouse-classList-js', 'https://cdnjs.cloudflare.com/ajax/libs/classlist/2014.01.31/classList.min.js', array('jquery'), '');
127
128
	wp_enqueue_script( 'lighthouse-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );
129
130
	wp_enqueue_script( 'lighthouse-material-menu-js', get_template_directory_uri() . '/js/materialMenu.js', array('jquery'), '', true );
131
132
	wp_enqueue_script( 'lighthouse-owl-carousel-js', get_template_directory_uri() . '/js/owl-carousel.js', array('jquery'), '', true );
133
134
	wp_enqueue_script( 'lighthouse-match-height-js', get_template_directory_uri() . '/js/jquery.matchHeight-min.js', array('jquery'), '', true );
135
136
	wp_enqueue_script( 'lighthouse-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
137
138
	wp_enqueue_script( 'lighthouse-settings-js', get_template_directory_uri() . '/js/lighthouse-settings.js', array('jquery'), '', true );
139
140
	wp_enqueue_script( 'lighthouse-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
141
142
	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
143
		wp_enqueue_script( 'comment-reply' );
144
	}
145
}
146
add_action( 'wp_enqueue_scripts', 'lighthouse_scripts' );
147
148
149
/**
150
 * Implement the Custom Header feature.
151
 */
152
require get_template_directory() . '/inc/custom-header.php';
153
154
/**
155
 * Custom template tags for this theme.
156
 */
157
require get_template_directory() . '/inc/template-tags.php';
158
159
/**
160
 * Custom functions that act independently of the theme templates.
161
 */
162
require get_template_directory() . '/inc/extras.php';
163
164
/**
165
 * Customizer additions.
166
 */
167
require get_template_directory() . '/inc/customizer.php';
168
169
/**
170
 * Load Jetpack compatibility file.
171
 */
172
require get_template_directory() . '/inc/jetpack.php';
173
174
175
/**
176
 * Custom Include files
177
 */
178
179
// ACF
180
include_once( get_stylesheet_directory() . '/includes/acf/acf.php' );
181
182
// ACF Settings
183
include_once( get_stylesheet_directory() . '/includes/acf-settings.php' );
184
185
// Widgets
186
include_once( get_stylesheet_directory() . '/includes/widgets.php' );
187
188
// Menus
189
include_once( get_stylesheet_directory() . '/includes/menus.php' );
190
191
// Theme Settings
192
include_once( get_stylesheet_directory() . '/includes/theme-settings.php' );
193
194
// Shortcodes
195
include_once( get_stylesheet_directory() . '/includes/shortcodes.php' );
196