<?php
/**
 * Shortcodes API
 * @since       1.0.0
 * @see Shortcode API https://codex.wordpress.org/Shortcode_API
 *
 * @todo Replace only if your creating your own Plugin
 * @todo dst - Find all and replace text
 * @todo dealer - Find all and replace text 
 *
 */

// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;


/**
 * Dependency File or Function 
 * 
 * @todo The required file is needed for dst_get_posts_of_a_current_dealer($post_id) function
 */

// require_once plugin_dir_path( __FILE__ ) . 'includes/admin/relational-db-query.php';

/**
 * Shortcode Features and Usage
 * 
 * Just insert into Posts or Pages :)
 * [dst-shortcode] - Display all Notes
 * [dst-shortcode id="ID"] - Display only particular dealer
 *
 */

function dst_shortcode_func( $atts ) {
	global $post;

	$default = array(
		// 'id' => '',
	);
	$a = shortcode_atts( $default, $atts );
	// $id = absint($a['id']);];
 	$friendly_html = DST()->html->search_box(); // @see includes/class-friendly-html.php
 	$map_args = DST()->db->get_option('','dst_options', false);

 	// var_dump($map_args);
 	$posts_meta = DST()->db->dealers_postmeta();
 	$friendly_html .= DST()->html->google_map($posts_meta, $map_args); // @see includes/class-friendly-html.php
	return $friendly_html;
}
add_shortcode( 'dst-shortcode', 'dst_shortcode_func' );