-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
81 lines (72 loc) · 2.4 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
<?php
/**
* Nordic functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*/
// Defines
define( 'NT_THEME_VERSION', '0.3.1' );
define( 'NT_THEME_DIR', get_template_directory() );
define( 'NT_THEME_URL', get_template_directory_uri() );
/**
* Update checker
*/
require 'update-checker/plugin-update-checker.php';
$NTUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://wordpress.sixteenbit.dev/updates/?action=get_metadata&slug=nordic-theme',
__FILE__,
'nordic-theme'
);
/**
* REQUIRED FILES
* Include required files.
*/
// Classes
require_once 'classes/class-theme-setup.php';
require_once 'classes/class-customizer.php';
require_once 'classes/class-tags.php';
require_once 'classes/class-dropdown-walker.php';
if ( ! function_exists( 'v_forcelogin' ) ) {
require_once 'classes/class-force-login.php';
}
// Theme actions
add_action( 'after_setup_theme', 'NT_Theme_Setup::setup' );
add_action( 'widgets_init', 'NT_Theme_Setup::sidebar' );
add_action( 'wp_enqueue_scripts', 'NT_Theme_Setup::assets' );
add_action( 'wp_head', 'NT_Theme_Setup::pingback' );
add_filter( 'body_class', 'NT_Theme_Setup::body_class' );
add_action( 'wp_print_footer_scripts', 'NT_Theme_Setup::skip_link_focus_fix' );
add_action( 'wp_body_open', 'NT_Theme_Setup::skip_link', 5 );
add_action( 'wp_head', 'NT_Theme_Setup::no_js_class' );
add_action( 'admin_menu', 'NT_Theme_Setup::disable_default_dashboard_widgets' );
add_action( 'widgets_init', 'NT_Theme_Setup::remove_default_widgets' );
remove_action( 'welcome_panel', 'wp_welcome_panel' );
add_filter( 'admin_footer_text', 'NT_Theme_Setup::custom_admin_footer' );
add_filter( 'get_the_archive_title', 'NT_Theme_Setup::get_the_archive_title' );
if ( ! function_exists( 'nordic_theme_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* Create your own nordic_theme_post_thumbnail() function to override in a child theme.
*/
function nordic_theme_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() || is_single() ) {
return;
}
?>
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
<?php
the_post_thumbnail(
'post-thumbnail',
array(
'alt' => the_title_attribute( 'echo=0' ),
)
);
?>
</a>
<?php
}
endif;