-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscroll-animations.php
58 lines (38 loc) · 1.73 KB
/
scroll-animations.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
<?php
/**
* Plugin Name: Scroll Animations
* Description: Uses Locomotive Scroll attributes to blocks to create smooth scrolling and parallax effects.
* Requires at least: 5.9
* Requires PHP: 7.0
* Version: 1.0.3
* Author: Melissa Hiatt
* Author URI: https://designcodespace.com
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: scroll-animations
*/
define( 'DCS_SCROLL_ANIMATIONS_VERSION', '1.0.3' );
define( 'PLUGIN_NAME', 'dcs-scroll-animations');
function locomotive_styles(){
wp_enqueue_style('locomotive', plugin_dir_url(__FILE__).'css/locomotive.css', DCS_SCROLL_ANIMATIONS_VERSION );
//wp_enqueue_style('animations', plugin_dir_url(__FILE__).'css/animations.css', DCS_SCROLL_ANIMATIONS_VERSION );
}
add_action('init', 'locomotive_styles');
//Register block
function dcs_scroll_animations_block_init() {
//Animation Block
register_block_type( plugin_dir_path( __FILE__ ) . 'build/animation-block/' );
register_block_type( plugin_dir_path( __FILE__ ) . 'build/animation-filters/' );
}
add_action( 'init', 'dcs_scroll_animations_block_init' );
//Add Settings
require_once 'includes/settings.php';
//Enqueue front-end scripts
function dcs_smooth_scroll_scripts(){
wp_enqueue_script('dcs_smooth_scroll', plugin_dir_url(__FILE__).'build/index.js', array(), DCS_SCROLL_ANIMATIONS_VERSION, true );
$option = get_option('dcs_scroll_animations_container');
$container = $option ? $option : '.wp-site-blocks'; //set default
$scrollSettings = ['container' => $container];
wp_localize_script( 'dcs_smooth_scroll', 'scrollSettings', $scrollSettings );
}
add_action('wp_enqueue_scripts', 'dcs_smooth_scroll_scripts', 30);