-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshortcode-handler.php
More file actions
27 lines (22 loc) · 961 Bytes
/
shortcode-handler.php
File metadata and controls
27 lines (22 loc) · 961 Bytes
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
<?php
if ( ! defined( 'ABSPATH' ) )
exit;
function php_code_display_content($php_code_short_code){
if(is_array($php_code_short_code)){
if(isset($php_code_short_code['include'])){
$php_code_include_file = $php_code_short_code['include'].".php";
$php_code_include_path = get_option('php_code_include_path');
$php_code_file_to_include = $php_code_include_path.$php_code_include_file;
if(file_exists($php_code_file_to_include)){
include_once $php_code_file_to_include;
}else {
?>Sorry i could not find File: <?php echo $php_code_file_to_include; ?><?php
}
}else {
?>Missing include Parameter for PHP Code Short Code<?php
print("<pre>".print_r($php_code_short_code,true)."</pre>");
}
}
}
add_shortcode('php-code','php_code_display_content');
add_filter('widget_text', 'do_shortcode');