-
Notifications
You must be signed in to change notification settings - Fork 13
/
foo-gallery.php
42 lines (39 loc) · 1.16 KB
/
foo-gallery.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
<?php
function my_foo_gallery_block_content( $html ){
if ( cmplz_uses_thirdparty('youtube') ) {
$pattern = '/fg-type-video.*?<a href="(.*?)"/i';
if ( preg_match_all( $pattern, $html,
$matches, PREG_PATTERN_ORDER )
) {
foreach ( $matches[0] as $key => $html_match ) {
$el = $matches[0][ $key ];
$src = $matches[1][ $key ];
if (strpos($src, 'youtube') !== false) {
$new_el = str_replace( 'class="fg-item-inner', 'class="fg-item-inner cmplz-placeholder-element ', $el );
$html = str_replace( $el, $new_el, $html );
}
}
}
}
return $html;
}
add_filter( 'cmplz_cookie_blocker_output' , 'my_foo_gallery_block_content' );
function my_cmplz_foo_gallery_css() {
if ( cmplz_uses_thirdparty('youtube') ) {
?>
<style>
.fg-type-video .cmplz-blocked-content-container .cmplz-blocked-content-notice {
width: 100%;
top: 0;
left: 0;
bottom: 0;
padding:3px;
transform: translate(0, 0);
font-size: 12px;
line-height: 15px;
}
</style>
<?php
}
}
add_action( 'wp_footer', 'my_cmplz_foo_gallery_css' );