-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
65 lines (62 loc) · 2.98 KB
/
functions.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
function ltk_show_widget($atts) {
extract(shortcode_atts(array(
'user_id' => '0',
'rows' => '1',
'cols' => '6',
'show_frame' => 'true',
'padding' => '0'
), $atts));
$out = '<div class="ltkwidget-widget" data-rows="'.$rows.'" data-cols="'.$cols.'" data-show-frame="'.$show_frame.'" data-user-id="'.$user_id.'" data-padding="'.$padding.'">
<script type="text/javascript" language="javascript">
!function(d,s,id){
var e, p = /^http:/.test(d.location) ? \'http\' : \'https\';
if(!d.getElementById(id)) {
e = d.createElement(s);
e.id = id;
e.src = p + \'://widgets.rewardstyle.com\' + \'/js/ltkwidget.js\';
d.body.appendChild(e);
}
}(document, \'script\', \'ltkwidget-script\');
if(typeof(window.__ltkwidget) === \'object\'){
if (document.readyState === \'complete\') {
__ltkwidget.init();
}
}
</script>
<div class="rs-adblock">
<img src="//assets.rewardstyle.com/images/search/350.gif" onerror="this.parentNode.innerHTML=\'Turn off your ad blocker to view content\'" />
<noscript>Turn on your JavaScript to view content</noscript>
</div>
</div>';
return $out;
}
add_shortcode('show_ltk_widget', 'ltk_show_widget');
function shopthepost_show_widget($atts) {
extract(shortcode_atts(array(
'id' => '0',
'adblock' => 'Turn off your ad blocker to view content',
'enableJs' => 'Turn on your JavaScript to view content'
), $atts));
$out = '<div class="shopthepost-widget" data-widget-id="'.$id.'">
<script type="text/javascript" language="javascript">
!function(d,s,id){
var e, p = /^http:/.test(d.location) ? \'http\' : \'https\';
if(!d.getElementById(id)) {
e = d.createElement(s);
e.id = id;
e.src = p + \'://widgets.rewardstyle.com/js/shopthepost.js\';
d.body.appendChild(e);
}
if(typeof window.__stp === \'object\') if(d.readyState === \'complete\') {
window.__stp.init();
}
}(document, \'script\', \'shopthepost-script\');
</script>
<div class="rs-adblock">
<img src="//assets.rewardstyle.com/images/search/350.gif" style="width:15px;height:15px;" onerror="this.parentNode.innerHTML=\''.$enableJs.'\'" />
<noscript>'.$adblock.'</noscript>
</div>
</div>';
return $out;
}
add_shortcode('show_shopthepost_widget', 'shopthepost_show_widget');