-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshortcode.php
42 lines (34 loc) · 1.42 KB
/
shortcode.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
// This includes the way to echo a single quote inside a single quote.
function vidyard_function( $atts, $content = null ) {
// Adding parameters to button. For this we use id to refernce video id.
$a = shortcode_atts( array(
'id' => '#',
'target' => '_self',
), $atts );
return '<button onclick="launchLightbox('. "'" . esc_attr($a['id']) . "'" .')" class="button">'. $content .'</button><div class="vidyard">
<div class="vidyard-player-embed" data-uuid="'. esc_attr($a['id']) .'" data-v="4" data-type="lightbox"></div>
</div><script>function launchLightbox(val) {
var players = VidyardV4.api.getPlayersByUUID(val);
var player = players[0];
player.showLightbox();
}</script> ';
}
// Name of shortcode is vidyard
add_shortcode('vidyard', 'vidyard_function');
?>
<?php
// Button shortcode
function button_shortcode( $atts, $content = null ) {
//set default attributes and values
$values = shortcode_atts( array(
'url' => '#',
'target' => '_self',
'color' => '',
), $atts );
return '<a href="'. esc_attr($values['url']) .'" target="'. esc_attr($values['target']) .'" class="primary-btn gray arrow'. esc_attr($values['color']) .'">'. $content .' </a>';
}
add_shortcode('button', 'button_shortcode');
?>
// Text entered in the back-end
[button url="https://local.jllt.com/nyc-proptech/" target="_blank"]Read now[/button]