PluginProbe
Insert Html Snippet / 1.3.6
Insert Html Snippet v1.3.6
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.3.6, at shortcode-handler.php

41 lines 917 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) )
3 exit;
4
5 global $wpdb;
6
7 add_shortcode('xyz-ihs','xyz_ihs_display_content');
8
9 function xyz_ihs_display_content($xyz_snippet_name){
10 global $wpdb;
11 if (is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ))
12 {
13 return ''; // Do not execute the shortcode in the admin area
14 }
15 if(is_array($xyz_snippet_name)&& isset($xyz_snippet_name['snippet'])){
16
17 $snippet_name = $xyz_snippet_name['snippet'];
18
19 $query = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE title=%s" ,$snippet_name));
20
21 if(!empty($query))//if(count($query)>0)
22 {
23 foreach ($query as $sippetdetails){
24 if($sippetdetails->status==1)
25 return do_shortcode($sippetdetails->content) ;
26 else
27 return '';
28 break;
29 }
30
31 }else{
32
33 return '';
34 }
35
36 }
37 }
38
39
40 add_filter('widget_text', 'do_shortcode'); // to run shortcodes in text widgets
41