| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly. |
| 5 |
} |
| 6 |
|
| 7 |
// Shortcodes |
| 8 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-latest-listings-list.php'; |
| 9 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-wdk-listing-field-value.php'; |
| 10 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-wdk-listing-field-value-text.php'; |
| 11 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-wdk-listing-field-value-suffix.php'; |
| 12 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-wdk-listing-field-value-prefix.php'; |
| 13 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-wdk-listing-field-label.php'; |
| 14 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-wdk-listing-fields-section.php'; |
| 15 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'shortcodes/shortcode-wdk-return-post-id.php'; |
| 16 |
|
| 17 |
function wdk_shortcodes_view($view_file = '', $element = '', $print = false) |
| 18 |
{ |
| 19 |
if(empty($view_file)) return false; |
| 20 |
$file = false; |
| 21 |
if(is_child_theme() && file_exists(get_stylesheet_directory().'/wpdirectorykit/elementor-elements/views/'.$view_file.'.php')) |
| 22 |
{ |
| 23 |
$file = get_stylesheet_directory().'/wpdirectorykit/elementor-elements/views/'.$view_file.'.php'; |
| 24 |
} |
| 25 |
elseif(file_exists(get_template_directory().'/wpdirectorykit/shortcodes/views/'.$view_file.'.php')) |
| 26 |
{ |
| 27 |
$file = get_template_directory().'/wpdirectorykit/shortcodes/views/'.$view_file.'.php'; |
| 28 |
} |
| 29 |
elseif(file_exists(WPDIRECTORYKIT_PATH.'shortcodes/views/'.$view_file.'.php')) |
| 30 |
{ |
| 31 |
$file = WPDIRECTORYKIT_PATH.'shortcodes/views/'.$view_file.'.php'; |
| 32 |
} |
| 33 |
|
| 34 |
if($file) |
| 35 |
{ |
| 36 |
extract($element); |
| 37 |
if($print) { |
| 38 |
include $file; |
| 39 |
} else { |
| 40 |
ob_start(); |
| 41 |
include $file; |
| 42 |
return ob_get_clean(); |
| 43 |
} |
| 44 |
} |
| 45 |
else |
| 46 |
{ |
| 47 |
if($print) { |
| 48 |
echo 'View file not found in: '.esc_html($file); |
| 49 |
} else { |
| 50 |
return 'View file not found in: '.$file; |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
?> |