| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly. |
| 5 |
} |
| 6 |
|
| 7 |
/* |
| 8 |
* Widget [wdk-return-post-id], show latest listings in list view |
| 9 |
* atts list: |
| 10 |
* |
| 11 |
*/ |
| 12 |
|
| 13 |
add_shortcode('wdk-return-post-id', 'shortcode_wdk_return_post_id'); |
| 14 |
function shortcode_wdk_return_post_id($atts, $content){ |
| 15 |
$atts = shortcode_atts(array( |
| 16 |
'id'=>NULL, |
| 17 |
), $atts); |
| 18 |
$data = array(); |
| 19 |
|
| 20 |
/* settings from atts */ |
| 21 |
$data['settings'] = $atts; |
| 22 |
$data['id_element'] = ''; |
| 23 |
|
| 24 |
global $wdk_listing_result_id; |
| 25 |
if(!empty($wdk_listing_result_id)) |
| 26 |
return $wdk_listing_result_id; |
| 27 |
|
| 28 |
global $wdk_listing_id; |
| 29 |
if(!empty($wdk_listing_id)) |
| 30 |
return $wdk_listing_id; |
| 31 |
|
| 32 |
return get_the_ID(); |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
?> |