PluginProbe
Insert Html Snippet / 1.2
Insert Html Snippet v1.2
1.4.6 trunk 1.0 1.0.1 1.1 1.1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4 1.4.1 1.4.2 1.4.3 All 27 releases
insert-html-snippet / shortcode-handler.php

shortcode-handler.php in Insert Html Snippet 1.2, at shortcode-handler.php

41 lines 979 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 global $wpdb;
3
4 add_shortcode('xyz-ihs','xyz_ihs_display_content');
5
6 function xyz_ihs_display_content($xyz_snippet_name){
7 global $wpdb;
8
9 if(is_array($xyz_snippet_name)){
10 $snippet_name = $xyz_snippet_name['snippet'];
11
12 $query = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE title=%s" ,$snippet_name));
13
14 if(count($query)>0){
15
16 foreach ($query as $sippetdetails){
17 // return stripslashes($sippetdetails->content);
18 if($sippetdetails->status==1)
19 return do_shortcode($sippetdetails->content) ;
20 else
21 return '';
22 break;
23 }
24
25 }else{
26
27 return '';
28 /* return "<div style='padding:20px; font-size:16px; color:#FA5A6A; width:93%;text-align:center;background:lightyellow;border:1px solid #3FAFE3; margin:20px 0 20px 0'>
29
30 Please use a valid short code to call snippet.
31
32
33 </div>";
34 */
35 }
36
37 }
38 }
39
40
41 add_filter('widget_text', 'do_shortcode'); // to run shortcodes in text widgets