-
Notifications
You must be signed in to change notification settings - Fork 2
/
hover-reveal-card.php
63 lines (57 loc) · 1.57 KB
/
hover-reveal-card.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
<?php
/**
* Plugin Name: Hover Reveal Card
* Description: Extends the Cover block for an animating card effect.
* Requires at least: 6.6
* Requires PHP: 8.0
* Version: 1.0.1
* Author: Damon Cook
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: hr-card
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Enqueues the block styles for the plugin.
*/
function hr_card_enqueue_block_styles() {
wp_enqueue_block_style(
'core/cover',
array(
'handle' => 'hr-card-cover-card--interactive',
'src' => plugin_dir_url( __FILE__ ) . 'assets/styles/core-blocks/cover-card--interactive.css',
'path' => plugin_dir_path( __FILE__ ) . 'assets/styles/core-blocks/cover-card--interactive.css',
)
);
}
add_action( 'init', 'hr_card_enqueue_block_styles' );
/**
* Registers a block pattern for the plugin.
*/
function hr_card_register_block_pattern() {
$pattern_file = plugin_dir_path( __FILE__ ) . '/patterns/cover-cards-hover-effect.php';
if ( ! file_exists( $pattern_file ) ) {
return;
}
register_block_pattern(
'hr-card/cover-cards-hover-effect',
require $pattern_file
);
}
add_action( 'init', 'hr_card_register_block_pattern' );
/**
* Registers the custom styles for the Cover block.
*/
function hr_card_register_block_styles() {
register_block_style(
'core/cover',
array(
'name' => 'card--interactive',
'label' => __( 'Card (Interactive)', 'cards' ),
'style_handle' => 'hr-card-cover-card--interactive',
)
);
}
add_action( 'init', 'hr_card_register_block_styles' );