-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
155 lines (131 loc) · 4.89 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
<?php
/**
* Adds theme support that's not yet enabled in theme.json.
*
* 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 fizzie_after_setup_theme()
{
add_action('wp_enqueue_scripts', 'fizzie_enqueue_styles');
add_action('wp_enqueue_scripts', 'fizzie_enqueue_a2z');
add_theme_support('wp-block-styles');
//add_theme_support('align-wide');
add_theme_support('custom-line-height');
add_theme_support('responsive-embeds');
/**
* If you use add_editor_style() it calls
* add_theme_support( 'editor-style' );
* ... which appears to be different from
* add_theme_support( 'editor-styles' );
* Or is it?
*
* There's also 'dark-editor-style'.
*/
/** Add support for using link colour in certain blocks
* https://developer.wordpress.org/block-editor/developers/themes/theme-support/#experimental-%e2%80%94-link-color-control
*/
add_theme_support('experimental-link-color');
// Add support for custom units. Is this necessary for FSE?
//add_theme_support( 'custom-units' );
/**
* You need to register nav menus in order for admin to display Appearance > Menus
* and for Navigation (beta) to allow you to Manage locations.
* But it's not at all clear how you indicate these locations in the theme's templates
* and the core/navigation block doesn't refer to a menu name.
*
* Additionally, I can't see how the server side rendering adds the class names required
* to allow the menu to display the current selection.
*/
//register_nav_menu( 'header', 'Header menu');
//register_nav_menu( 'footer', 'Footer menu');
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* 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' );
// There should be no need to set post thumbnail size.
//set_post_thumbnail_size( 256, 256, false );
// Add support for default block styles.
add_theme_support( 'wp-block-styles' );
//add_theme_support( 'editor-styles' );
//add_editor_style( 'style-editor.css' );
// Enqueue editor styles.
//add_editor_style( 'style.css' );
//add_editor_style( 'style-editor.css' );
// Add support for full and wide align blocks.
//add_theme_support( 'align-wide' );
}
/**
* Enables oik based shortcodes.
*/
function fizzie_init() {
if (function_exists('bw_add_shortcode')) {
do_action("oik_add_shortcodes");
}
}
function fizzie_enqueue_styles() {
//$theme_version = wp_get_theme()->get( 'Version' );
if ( defined( 'SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
$theme_version = filemtime( get_stylesheet_directory() . "/style.css" );
} else {
$theme_version = wp_get_theme()->get( 'Version' );
}
wp_enqueue_style( 'fizzie', get_stylesheet_uri(), array(), $theme_version );
}
/**
* Enqueue special styles for archives
*/
function fizzie_enqueue_a2z() {
//echo get_template_directory(); fizzie
//echo get_stylesheet_directory(); wizzie
$timestamp = null;
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
$timestamp = filemtime( get_template_directory() . "/category.css" );
}
wp_enqueue_style( "category-css", get_template_directory_uri() . '/category.css', array() );
}
add_action( 'after_setup_theme', 'fizzie_after_setup_theme');
//add_action( 'after_setup_theme', 'fizzie_stanley_theme_support');
add_action( 'init', 'fizzie_init', 20 );
/**
* Use front-page.php when Front page displays is set to a static page.
*
* @since Twenty Seventeen 1.0
*
* @param string $template front-page.php.
* @return string The template to be used: blank if is_home() is true (defaults to index.php),
* otherwise $template.
*/
function fizzie_front_page_template( $template ) {
//echo $template;
return is_home() ? '' : $template;
}
add_filter( 'frontpage_template', 'fizzie_front_page_template' );
/**
* Filters the rendered shortcode block.
*
* @param $content
* @param $parsed_block
* @param $block
* @return mixed|string
*/
function fizzie_render_block_core_shortcode( $content, $parsed_block, $block ) {
$content = do_shortcode( $content );
return $content;
}
add_filter( 'render_block_core/shortcode', 'fizzie_render_block_core_shortcode', 10, 3, );
add_filter( 'render_block_core/paragraph', 'fizzie_render_block_core_shortcode', 10, 3, );
require_once __DIR__ . '/includes/block-overrides.php';
if ( !function_exists( "bw_trace2" ) ) {
function bw_trace2( $content=null, $args=null) {
return $content;
}
}