-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathghstwrtr.php
83 lines (74 loc) · 1.91 KB
/
ghstwrtr.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
<?php
/**
* Plugin Name: Ghostwriter
* Plugin URI: https://sortabrilliant.com/ghostwriter/
* Description: Static headings are boring, let’s get them moving.
* Author: sorta brilliant
* Author URI: https://sortabrilliant.com
* Version: 1.0.4
* License: GPL2+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
* @package Ghostwriter
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'GHSTWRTR_VERSION', '1.0.4' );
define( 'GHSTWRTR_PLUGIN_DIR', dirname( __FILE__ ) );
define( 'GHSTWRTR_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
/**
* Enqueue block assets for the editor.
*
* @since 1.0.0
*/
function ghstwrtr_editor_assets() {
$asset_filepath = GHSTWRTR_PLUGIN_DIR . '/build/index.asset.php';
$asset_file = file_exists( $asset_filepath ) ? include $asset_filepath : array(
'dependencies' => array(),
'version' => GHSTWRTR_VERSION,
);
wp_enqueue_script(
'ghstwrtr-block-js',
GHSTWRTR_PLUGIN_URL . 'build/index.js',
$asset_file['dependencies'],
$asset_file['version'],
true
);
}
add_action( 'enqueue_block_editor_assets', 'ghstwrtr_editor_assets' );
/**
* Enqueue block assets for the theme.
*
* @since 1.0.0
*/
function ghstwrtr_scripts() {
$asset_filepath = GHSTWRTR_PLUGIN_DIR . '/build/ghstwrtr-theme.asset.php';
$asset_file = file_exists( $asset_filepath ) ? include $asset_filepath : array(
'dependencies' => array(),
'version' => GHSTWRTR_VERSION,
);
wp_register_script(
'ghstwrtr-theme-js',
GHSTWRTR_PLUGIN_URL . 'build/ghstwrtr-theme.js',
$asset_file['dependencies'],
$asset_file['version'],
true
);
wp_localize_script(
'ghstwrtr-theme-js',
'_SBB_GHOSTWRITER',
array(
'typedjs_options' => apply_filters(
'ghstwrtr_typedjs_options',
array(
'typeSpeed' => 75,
'loop' => true,
)
),
)
);
wp_enqueue_script( 'ghstwrtr-theme-js' );
}
add_action( 'wp_enqueue_scripts', 'ghstwrtr_scripts' );