| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly. |
| 5 |
} |
| 6 |
|
| 7 |
/* |
| 8 |
* Widget [wdk-listing-field-label], show latest listings in list view |
| 9 |
* atts list: |
| 10 |
* |
| 11 |
* field_id (int) - field id |
| 12 |
* post_id (int) - post_id |
| 13 |
* |
| 14 |
* Layout path : |
| 15 |
* get_template_directory().'/wpdirectorykit/shortcodes/views/shortcode-latest-listings-list.php' |
| 16 |
* WPDIRECTORYKIT_PATH.'shortcodes/views/shortcode-latest-listings-list.php' |
| 17 |
*/ |
| 18 |
|
| 19 |
add_shortcode('wdk-listing-field-label', 'shortcode_wdk_listing_field_label'); |
| 20 |
function shortcode_wdk_listing_field_label($atts, $content){ |
| 21 |
$atts = shortcode_atts(array( |
| 22 |
'id'=>NULL, |
| 23 |
'field_id'=>'', |
| 24 |
'post_id'=>'', |
| 25 |
'enable_html'=>'', |
| 26 |
), $atts); |
| 27 |
$data = array(); |
| 28 |
|
| 29 |
/* settings from atts */ |
| 30 |
$data['settings'] = $atts; |
| 31 |
$data['id_element'] = ''; |
| 32 |
|
| 33 |
/* load css/js */ |
| 34 |
|
| 35 |
$WMVC = &wdk_get_instance(); |
| 36 |
$WMVC->model('listingfield_m'); |
| 37 |
$WMVC->model('listing_m'); |
| 38 |
$WMVC->load_helper('listing'); |
| 39 |
|
| 40 |
$data['field_label'] = ''; |
| 41 |
if(!empty($data['settings']['field_id'])) { |
| 42 |
$data['field_label'] = wdk_field_label($data['settings']['field_id']); |
| 43 |
} |
| 44 |
|
| 45 |
return wdk_shortcodes_view('shortcode-wdk-listing-field-label', $data); |
| 46 |
} |
| 47 |
|
| 48 |
?> |