Repository navigation
Expand file tree
/
Copy pathfunctions.php
More file actions
112 lines (98 loc) · 3.48 KB
/
Copy pathfunctions.php
File metadata and controls
112 lines (98 loc) · 3.48 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
<?php
/**
* Uncoder theme: setup, assets and the integration with the Uncoder builder plugin.
*
* @package Uncoder_Theme
*/
defined( 'ABSPATH' ) || exit;
define( 'UNCODER_THEME_VERSION', '1.0.0' );
require get_template_directory() . '/inc/uncoder.php';
require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/updater.php';
if ( is_admin() ) {
require get_template_directory() . '/inc/admin-notice.php';
}
/**
* Width of the reading column, for embeds and images inserted in the classic editor.
*/
function uncoder_theme_content_width(): void {
$GLOBALS['content_width'] = (int) apply_filters( 'uncoder_theme_content_width', 720 );
}
add_action( 'after_setup_theme', 'uncoder_theme_content_width', 0 );
/**
* Theme supports, menus and editor styles.
*/
function uncoder_theme_setup(): void {
load_theme_textdomain( 'uncoder-theme', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', 'navigation-widgets' ) );
add_theme_support(
'custom-logo',
array(
'height' => 96,
'width' => 320,
'flex-height' => true,
'flex-width' => true,
)
);
add_theme_support( 'align-wide' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'editor-styles' );
add_editor_style( 'assets/css/editor-style.css' );
// WooCommerce renders inside woocommerce.php.
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
register_nav_menus(
array(
'primary' => esc_html__( 'Primary menu', 'uncoder-theme' ),
'footer' => esc_html__( 'Footer menu', 'uncoder-theme' ),
)
);
}
add_action( 'after_setup_theme', 'uncoder_theme_setup' );
/**
* Front-end styles. The minified build of style.css, or style.css itself with SCRIPT_DEBUG.
*/
function uncoder_theme_enqueue(): void {
$file = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? 'style.css' : 'assets/css/theme.min.css';
wp_enqueue_style( 'uncoder-theme', get_template_directory_uri() . '/' . $file, array(), UNCODER_THEME_VERSION );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'uncoder_theme_enqueue' );
/**
* Skip link, printed from wp_body_open so it is there with the theme header and with an Uncoder header.
*/
function uncoder_theme_skip_link(): void {
// The Uncoder Canvas template and Theme Builder template previews have no #content.
if ( is_page_template( 'uncoder-canvas' ) || is_singular( 'uncoder_template' ) ) {
return;
}
printf(
'<a class="skip-link screen-reader-text" href="#content">%s</a>',
esc_html__( 'Skip to content', 'uncoder-theme' )
);
}
add_action( 'wp_body_open', 'uncoder_theme_skip_link', 5 );
/**
* Shorter excerpts with an ellipsis for the post cards.
*
* @param int $length Number of words.
*/
function uncoder_theme_excerpt_length( $length ): int {
return is_admin() ? (int) $length : 28;
}
add_filter( 'excerpt_length', 'uncoder_theme_excerpt_length' );
/**
* Replaces the "[…]" after excerpts.
*/
function uncoder_theme_excerpt_more(): string {
return '…';
}
add_filter( 'excerpt_more', 'uncoder_theme_excerpt_more' );