-
Notifications
You must be signed in to change notification settings - Fork 5
/
aesop.php
53 lines (46 loc) · 1.51 KB
/
aesop.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
<?php
/**
* Aesop Story Engine Compatibility File
*
* @package Cover2
*/
/**
* Enqueue Aesop styles.
*/
function cover2_aesop_styles() {
wp_register_style( 'cover2-aesop-style', get_template_directory_uri() . '/dist/css/plugins/aesop.css', array(), filemtime( get_template_directory() . '/dist/css/plugins/aesop.css' ) );
// Check for the first shortcode ASE registers.
// NOTE if shortcodes will be removed in the future, this will have to change.
if ( shortcode_exists( 'aesop_chapter' ) ) {
wp_enqueue_style( 'cover2-aesop-style' );
}
}
add_action( 'wp_enqueue_scripts', 'cover2_aesop_styles' );
/**
* Override the font size unit
*/
function cover2_quote_size_unit() {
return 'rem';
}
add_filter( 'aesop_quote_size_unit', 'cover2_quote_size_unit' );
function cover2_content_overlay() {
echo '<div class="aesop-content-darken"></div>';
return;
}
add_action('aesop_cbox_content_inside_top', 'cover2_content_overlay');
function has_ase_chapters( $post ) {
if ( is_object( $post ) && ( is_single() || is_page() ) ) :
if ( has_shortcode( $post->post_content, 'aesop_chapter' ) ) :
return true;
endif;
if ( function_exists( 'has_blocks' ) && has_blocks( $post->post_content ) ) :
$blocks = gutenberg_parse_blocks( $post->post_content );
foreach ( $blocks as $block ) {
if ( array_key_exists('blockName', $block) && $block['blockName'] == 'ase/chapter' ) :
return true;
endif;
}
endif;
endif;
return false;
}