<?php
/**
 * The Core Functions for SKT Ele Restaurant Lite
 *
 * These core functions are the main feature of the complete.
 *
 * @package SKT Ele Restaurant Lite
 * 
 * @since SKT Ele Restaurant Lite 1.0
 */
 
ini_set('display_errors','Off');

//CONTENT WIDTH
function complete_content_width() {
	global $content_width;
	$full_width = is_page_template( 'page-fullwidth_template.php' );
	if ( $full_width ) {
		$content_width = 1100;
	}else {
		$content_width = 690;
	}
}
add_action( 'template_redirect', 'complete_content_width' );


//UPDATED: GET THE FIRST IMAGE
function complete_first_image() {
	if(is_404()){
		return;
	}
	global $wp_query;
/*	if( $wp_query->post_count <1){
		return;
	}*/
		global $post, $posts;
		$image_url = '';
		ob_start();
		ob_end_clean();
		if(preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches)){;
		$image_url = $matches [1] [0];
		}
	return $image_url;
}

//complete Site title
if ( ! function_exists( '_wp_render_title_tag' ) ) {
	function complete_wp_title( $title, $sep ) {
		global $paged, $page;
	
		if ( is_feed() )
			return $title;
	
		// Add the site name.
		$title .= get_bloginfo( 'name' );
		$sep ='|';
		// Add the site description for the home/front page.
		$site_description = get_bloginfo( 'description', 'display' );
		if ( $site_description && ( is_home() || is_front_page() ) )
			$title = "$title $sep $site_description";
	
		// Add a page number if necessary.
		if ( $paged >= 2 || $page >= 2 )
			$title = "$title $sep " . sprintf( __( 'Page %s', 'complete' ), max( $paged, $page ) );
	
		return $title;
	}
	add_filter( 'wp_title', 'complete_wp_title', 10, 2 );
}

//Custom Excerpt Length
function complete_excerptlength_teaser($length) {
    return 20;
}
function complete_excerptlength_index($length) {
    return 12;
}
function complete_excerptmore($more) {
    return '...';
}

function complete_excerpt($length_callback='', $more_callback='') {
    if(function_exists($length_callback)){
        add_filter('excerpt_length', $length_callback);
    }
    if(function_exists($more_callback)){
        add_filter('excerpt_more', $more_callback);
    }
    $output = get_the_excerpt();
    $output = apply_filters('wptexturize', $output);
    $output = apply_filters('convert_chars', $output);
    $output = '<p>'.$output.'</p>';
    echo $output;
}

//Get Attachment data
function complete_get_attachment( $attachment_id ) {

$attachment = get_post( $attachment_id );
return array(
    'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
    'caption' => $attachment->post_excerpt,
    'description' => $attachment->post_content,
    'href' => get_permalink( $attachment->ID ),
    'src' => $attachment->guid,
    'title' => $attachment->post_title
);
}

//hex to rgb function
function complete_hex2rgb($hex) {
   $hex = str_replace("#", "", $hex);
 
   if(strlen($hex) == 3) {
      $r = hexdec(substr($hex,0,1).substr($hex,0,1));
      $g = hexdec(substr($hex,1,1).substr($hex,1,1));
      $b = hexdec(substr($hex,2,1).substr($hex,2,1));
   } else {
      $r = hexdec(substr($hex,0,2));
      $g = hexdec(substr($hex,2,2));
      $b = hexdec(substr($hex,4,2));
   }
   $rgb = array($r, $g, $b);
   return implode(",", $rgb); // returns the rgb values separated by commas
   //return $rgb; // returns an array with the rgb values
}

/*complete Color Sanitization*/
function complete_sanitize_hex( $color = '#FFFFFF', $hash = true ) {
		$color = trim( $color );
		$color = str_replace( '#', '', $color );
		if ( 3 == strlen( $color ) ) {
			$color = substr( $color, 0, 1 ) . substr( $color, 0, 1 ) . substr( $color, 1, 1 ) . substr( $color, 1, 1 ) . substr( $color, 2, 1 ) . substr( $color, 2, 1 );
		}

		$substr = array();
		for ( $i = 0; $i <= 5; $i++ ) {
			$default    = ( 0 == $i ) ? 'F' : ( $substr[$i-1] );
			$substr[$i] = substr( $color, $i, 1 );
			$substr[$i] = ( false === $substr[$i] || ! ctype_xdigit( $substr[$i] ) ) ? $default : $substr[$i];
		}
		$hex = implode( '', $substr );

		return ( ! $hash ) ? $hex : '#' . $hex;

}

// allow script & iframe tag within posts
function complete_allow_html( $allowedposttags ){
	global $allowedposttags;
    $allowedposttags['script'] = array(
        'type' => true,
        'src' => true,
        'height' => true,
        'width' => true,
    );
    $allowedposttags['form'] = array(
        'id' => true,
        'class' => true,
        'action' => true,
        'method' => true,
        'name' => true,
        'style' => true,
        'target' => true,
		'novalidate' => true,
    );
    $allowedposttags['input'] = array(
        'id' => true,
        'class' => true,
        'name' => true,
        'style' => true,
        'placeholder' => true,
		'tabindex' => true,
		'type' => true,
		'value' => true,
    );
    $allowedposttags['button'] = array(
        'id' => true,
        'class' => true,
        'name' => true,
        'style' => true,
		'tabindex' => true,
		'type' => true,
		'value' => true,
    );
	

    return $allowedposttags;
}
add_filter('wp_kses_allowed_html','complete_allow_html', 1);

//**Return an ID of an attachment by searching the database with the file URL (Inexpensive query)**//
function complete_attachment_id_by_url( $url ) {
	$parsed_url  = explode( parse_url( WP_CONTENT_URL, PHP_URL_PATH ), $url );

	$this_host = str_ireplace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) );
	$file_host = str_ireplace( 'www.', '', parse_url( $url, PHP_URL_HOST ) );

	if ( ! isset( $parsed_url[1] ) || empty( $parsed_url[1] ) || ( $this_host != $file_host ) ) {
		return;
	}

	global $wpdb;
	$attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;", $parsed_url[1] ) );
	return $attachment[0];
}

//Get Image alt from image src
function complete_image_alt( $attachment ) {
	$imgid = complete_attachment_id_by_url($attachment);
	
	if($imgid){
		$imgaltraw = wp_prepare_attachment_for_js($imgid); 
		$imgalt = $imgaltraw['alt'];
		if(!empty($imgalt)){ $imgalt = 'alt="'.$imgaltraw['alt'].'"'; }
		
	}else{
		$imgalt = '';
	}
	
	return $imgalt;
}

//[clear]
function clear_func() {
	$clr = '<div class="clear"></div>';
	return $clr;
}
add_shortcode( 'clear', 'clear_func' );


//[space height="20"]
function space_shortcode_func($atts ) {
 extract( shortcode_atts( array(
  'height' => '20',
 ), $atts ) );
 $sptr = '<div class="spacecode" style="height:'.$height.'px;"></div>';
 return $sptr;
}
add_shortcode( 'space', 'space_shortcode_func' );

// Social Icon Shortcodes
/*[social_area]
    [social icon="facebook" link="#"]
    [social icon="twitter" link="#"]
    [social icon="google-plus" link="#"]	
    [social icon="linkedin" link="#"]
    [social icon="pinterest" link="#"]
[/social_area]*/
function complete_social_area($atts,$content = null){
  return '<div class="social-icons">'.do_shortcode($content).'</div>';
 }
add_shortcode('social_area','complete_social_area');

function complete_social($atts){
 extract(shortcode_atts(array(
  'icon' => '',
  'link' => ''
 ),$atts));
  return '<a href="'.$link.'" target="_blank" class="fa fa-'.$icon.' fa-1x" title="'.$icon.'"></a>';
 }
add_shortcode('social','complete_social');

// Footer Posts
/*[footerposts show="3"]*/
function footerpost_func( $atts ){
	global $post;
   extract( shortcode_atts( array(
		'show' => '',
	), $atts ) );
	$postoutput = '';
	wp_reset_query();
	query_posts(  array( 'posts_per_page'=>$show, 'post__not_in' => get_option('sticky_posts') )  );
	$postoutput .='<div class="footer-blog-posts">
            	<ul>';
	if ( have_posts() ) :
		while ( have_posts() ) : the_post();
 			if ( has_post_thumbnail()) {
				$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'footerthumb' );
				$imgUrl = '<img src="'.$large_image_url[0].'"/>';
			}
			else
			{ 
				$imgUrl = '<img style="display:none;" src=""/>';
			}
			$postoutput .= '<li><a href="'.get_the_permalink().'">'.get_the_title().'</a></li>';
		endwhile;
	endif;
	wp_reset_query();
	$postoutput .= '</ul></div>';
	return $postoutput;
}
add_shortcode( 'footerposts', 'footerpost_func' );	

// Shortcode Flip Box
/*[flipbox fliptype="fliptype" frontimage="frontimage" fronttitle="fronttitle" frontdescription="frontdescription" backtitle="backtitle" backdescription="backdescription" backurl="backurl" backbutton="backbutton"]*/
function flip($atts){
		extract( shortcode_atts(array(
			'fliptype' => 'fliptype',
			'frontimage' => 'frontimage',
			'fronttitle' => 'fronttitle',
			'frontdescription' => 'frontdescription',
			'backtitle' => 'backtitle',
			'backdescription' => 'backdescription',
			'backurl' => 'backurl',
			'backbutton' => 'backbutton',
		), $atts));
		
		return '
		<div class="flipcard '.$fliptype.'">
    <div class="front">
      	<div class="frontimage"><img src="'.$frontimage.'"/></div>
        <h3>'.$fronttitle.'</h3>
        <p>'.$frontdescription.'</p>
    </div>
    <div class="back">
	  <h3>'.$backtitle.'</h3>
      <p style="margin-bottom:20px;">'.$backdescription.'</p>
	  <a style="color:#FFF;" href="'.$backurl.'" class="sktmore"> '.$backbutton.' </a>
    </div>
</div>';

}
add_shortcode('flipbox','flip');

// Shortcode Divider
/*[divider style="divider1"]*/
function dividerstyle($atts){
		extract( shortcode_atts(array(
			'style' => 'style',
		), $atts));
		
		return '
		<div class="'.$style.'"><span></span></div>
		';
}
add_shortcode('divider','dividerstyle');

// Shortcode Heading Divider
/*[headingdivider text="text"]*/
function dividerstyleheading($atts){
		extract( shortcode_atts(array(
			'text' => 'text',
		), $atts));
		
		return '
		 <div class="fusion-title"><h3>'.$text.'</h3><div class="title-sep-container"><div class="title-sep sep-double"></div></div></div>
		';

}
add_shortcode('headingdivider','dividerstyleheading');

// Shortcode Heading Seperator
/*[headingseperator text="text"]*/
function headingseperatorstyle($atts){
		extract( shortcode_atts(array(
			'text' => 'text',
		), $atts));
		
		return '
		 <div class="headingseperator"><h3>'.$text.'</h3></div>
		';

}
add_shortcode('headingseperator','headingseperatorstyle');

// Shortcode Center Title Seperator
/*[centertitle text="text" titlecolor="#ffffff" seperatorcolor="#ffffff"]*/
function titlesep($atts){
		extract( shortcode_atts(array(
			'text' => 'text',
			'titlecolor' => 'seperatorcolor',
			'seperatorcolor' => 'seperatorcolor',
		), $atts));
		
		return '
		<div class="center-title"><h2 style="color:'.$titlecolor.'">'.$text.'</h2><span style="border-bottom-color:'.$seperatorcolor.'"></span></div>
		';

}
add_shortcode('centertitle','titlesep');

// Shortcode Promobox1
/* [promobox1 bgcolor="#f7f7f7" topbordercolor="#b71c1c" otherbordercolor="#e8e6e6"]Description[/promobox1] */
function promo1($atts, $content = null){
		extract( shortcode_atts(array(
			'bgcolor'  => 'bgcolor',
			'topbordercolor'  => 'topbordercolor',
			'otherbordercolor'  => 'otherbordercolor',
		), $atts));
		
		return '
			 <div class="promo1" style="background-color:'.$bgcolor.'; border-color: '.$topbordercolor.' '.$otherbordercolor.' '.$otherbordercolor.';">
             	'.$content.'
             </div>	
		';
}
add_shortcode('promobox1','promo1');

// Shortcode Promobox2
/* [promobox2 bgcolor="#f7f7f7" leftbordercolor="#b71c1c" button="Hello Text" url="#"]Description[/promobox2] */
function promo2($atts, $content = null){
		extract( shortcode_atts(array(
			'bgcolor'  => 'bgcolor',
			'leftbordercolor'  => 'leftbordercolor',
			'button'  => 'button',
			'url'  => 'url',
		), $atts));
		
		return '
			 <div class="promo2" style="background-color:'.$bgcolor.'; border-left-color:'.$leftbordercolor.';">
             	<div class="promo-left">
             	'.$content.'
                </div>
                <div class="promo-right">
                <div class="sktmore"><a href="'.$url.'">'.$button.'</a></div>
                </div>
                <div class="clear"></div>
             </div>	
		';
}
add_shortcode('promobox2','promo2');

// Shortcode Promobox3
/* [promobox3 bgcolor="#f7f7f7" bottombordercolor="#b71c1c" button="Hello Text" url="#"]Description[/promobox3] */
function promo3($atts, $content = null){
		extract( shortcode_atts(array(
			'bgcolor'  => 'bgcolor',
			'bottombordercolor'  => 'bottombordercolor',
			'button'  => 'button',
			'url'  => 'url',
		), $atts));
		
		return '
			 <div class="promo3" style="background-color:'.$bgcolor.'; border-bottom-color:'.$bottombordercolor.';">
             	'.$content.'
                <div class="sktmore"><a href="'.$url.'">'.$button.'</a></div>
             </div>	
		';
}
add_shortcode('promobox3','promo3');

// Shortcode Promobox4
/* [promobox4 bgcolor="#f7f7f7" bordercolor="#b71c1c"]Description[/promobox4] */
function promo4($atts, $content = null){
		extract( shortcode_atts(array(
			'bgcolor'  => 'bgcolor',
			'bordercolor'  => 'bordercolor',
		), $atts));
		
		return '
			<div class="promo4" style="background-color:'.$bgcolor.'; border-color:'.$bordercolor.';">
            	'.$content.'
             </div>	
		';
}
add_shortcode('promobox4','promo4');

// Shortcode Promobox5
/* [promobox5 bgcolor="#f7f7f7" button="Hello Text" url="#"]Description[/promobox5] */
function promo5($atts, $content = null){
		extract( shortcode_atts(array(
			'bgcolor'  => 'bgcolor',
			'button'  => 'button',
			'url'  => 'url',
		), $atts));
		
		return '
			 <div class="promo5" style="background-color:'.$bgcolor.';">
             	'.$content.'
                <div class="sktmore"><a href="'.$url.'">'.$button.'</a></div>
             </div>	
		';
}
add_shortcode('promobox5','promo5');

// Shortcode Cols
/* [columns size="1"][/columns] */
function cols($atts, $content = null){
		extract( shortcode_atts(array(
			'size'  => 'size',
		), $atts));
		
		return '
			<div class="skt-columns-'.$size.'">'.do_shortcode($content).'</div>  	
		';
}
add_shortcode('columns','cols');

// Shortcode Features Left
/*[featuresleft url="#" title="title" description="description" ordernumber="ordernumber"]*/
function featuresboxleft($atts){
		extract( shortcode_atts(array(
			'url' => 'url',
			'title' => 'title',
			'description' => 'description',
			'ordernumber' => 'ordernumber'
		), $atts));
		
		return '
				<div class="left-fitbox">
				<a href="'.$url.'">
				<div class="left-fitleft">
					<div class="left-fit-title"><h3>'.$title.'</h3></div>
					<div class="left-fit-desc">'.$description.'</div>
				</div>
				<div class="left-fitright">'.$ordernumber.'</div>
				</a>
				</div>
				<div class="clear"></div>
		';
}
add_shortcode('featuresleft','featuresboxleft');

// Shortcode Thumb Box
/*[featurethumb url="#" image="image"]*/
function thumbnailbox($atts){
		extract( shortcode_atts(array(
			'url' => 'url',
			'image' => 'image'
		), $atts));
		
		return '
                <div class="featurethumb">
                    <a href="'.$url.'"><img src="'.$image.'"/></a>
                </div>
		';
}
add_shortcode('featurethumb','thumbnailbox');

// Shortcode Features Right
/*[featuresright url="#" title="title" description="description" ordernumber="ordernumber"]*/
function featuresboxright($atts){
		extract( shortcode_atts(array(
			'url' => 'url',
			'title' => 'title',
			'description' => 'description',
			'ordernumber' => 'ordernumber'
		), $atts));
		
		return '
				<div class="right-fitbox">
				<a href="'.$url.'">
				<div class="right-fitleft">'.$ordernumber.'</div>
				<div class="right-fitright">
				<div class="right-fit-title"><h3>'.$title.'</h3></div>
				<div class="right-fit-desc">'.$description.'</div></div>
				</a>
				</div>
				<div class="clear"></div>
		';
}
add_shortcode('featuresright','featuresboxright');

// Shortcode Blocks
/* [blocks icon="image.jpg" title="Title" readmoretext="Read More" url="#"]Description[/blocks] */
// add shortcode for blocks
function blocksbox($atts, $content = null){
		extract( shortcode_atts(array(
			'icon'  => 'icon',
			'title'  => 'title',
			'readmoretext'  => 'readmoretext',
			'url' => 'url',
		), $atts));
		
		return '
			 <div class="blocksbox">
							<div class="blockthumb"><img src="'.$icon.'" /></div>
							<div class="blocktitle">
								<h3>'.$title.'</h3>
							</div>
							<div class="blockdesc">'.$content.'</div>
							<div class="blockmore"><a href="'.$url.'">'.$readmoretext.'</a></div>
						</div>
		';
}
add_shortcode('blocks','blocksbox');

//[ourteamexpanded show="4"]
function ourteamexpand_func( $atts, $show ) {
	extract( shortcode_atts( array( 'show' => $show), $atts ) ); 
	$args = array( 'post_type' => 'team', 'posts_per_page' => $show, 'post__not_in' => get_option('sticky_posts'), 'orderby' => 'date', 'order' => 'desc' );
	query_posts( $args );
                    if (have_posts()) {
                              $grid_img = '';
                              $grid_details = '';
                              $i = 1;
                              while (have_posts()) : the_post();

										$designation = esc_html( get_post_meta( get_the_ID(), 'designation', true ) );
										if( $designation != '' ){
										$desigcheck = '<div class="designation">'.$designation.'</div>';
										}

										$facebook = get_post_meta( get_the_ID(), 'facebook', true );
										$facebooklink = get_post_meta( get_the_ID(), 'facebooklink', true );
										
										if( $facebook != '' ){
                    					$facebookcheck = '<a href="'.$facebooklink.'" title="'.$facebook.'" target="_blank"><i class="fa fa-'.$facebook.' fa-lg"></i></a>';
										}
										
										$twitter = get_post_meta( get_the_ID(), 'twitter', true );
										$twitterlink = get_post_meta( get_the_ID(), 'twitterlink', true );
										
 										if( $twitter != '' ){
                    					$twittercheck = '<a href="'.$twitterlink.'" title="'.$twitter.'" target="_blank"><i class="fa fa-'.$twitter.' fa-lg"></i></a>';
										}

										$googleplus = get_post_meta( get_the_ID(), 'googleplus', true );
										$googlepluslink = get_post_meta( get_the_ID(), 'googlepluslink', true );
										
										if( $googleplus != '' ){
                    					$googlepluscheck = '<a href="'.$googlepluslink.'" title="'.$googleplus.'" target="_blank"><i class="fa fa-'.$googleplus.' fa-lg"></i></a>';
										}	
										

										$linkedin = get_post_meta( get_the_ID(), 'linkedin', true );
										$linkedinlink = get_post_meta( get_the_ID(), 'linkedinlink', true );
										
										if( $linkedin != '' ){
                    					$linkedincheck = '<a href="'.$linkedinlink.'" title="'.$linkedin.'" target="_blank"><i class="fa fa-'.$linkedin.' fa-lg"></i></a>';
										}										
										

										$pinterest = get_post_meta( get_the_ID(), 'pinterest', true );
										$pinterestlink = get_post_meta( get_the_ID(), 'pinterestlink', true );		
										
										if( $pinterest != '' ){
                    					$pinterestcheck = '<a href="'.$pinterestlink.'" title="'.$pinterest.'" target="_blank"><i class="fa fa-'.$pinterest.' fa-lg"></i></a>';
										}
																  
                                        $thumb = get_post_thumbnail_id();
                                        $img_url = wp_get_attachment_url($thumb, 'full');
										$title = get_the_title();
                                        $content = do_shortcode(get_the_content());
                                        $grid_img .= '<li><a href="#section'.$i.'"><div class="expandthumb"><img src="' . $img_url . '" /></div></a></li>';
                                        $grid_details .= '<div id="section' . $i . '" class="expanding-container">
										<div class="expandarea">
										<div class="expand-left">
											<h2>'.$title.'</h2>
											'.$desigcheck.' 
											<div class="social-icons teamicon">'.$facebookcheck.''.$twittercheck.''.$googlepluscheck.''.$linkedincheck.''.$pinterestcheck.'</div>	
											<div class="clear"></div>
											<div class="expandcontent">'.$content.'</div>
										</div>
										<div class="expand-right">
											<div class="img-placeholder">
												<div class="entry-image"><img src="' . $img_url . '" /></div>
												</div>
										</div>
										</div>
										<div class="clear"></div>
										</div>';
                                        $i++;
                              endwhile;
                              $output = '<div class="expanding-grid"><ul class="links"> ' . $grid_img . '</ul>' . $grid_details . '</div>';
                    }else {
                              $output = __('No Team Member Found', 'complete');
                    }
                    wp_reset_postdata();
                    wp_reset_query();
                    return $output;
          }

add_shortcode('ourteamexpanded', 'ourteamexpand_func'); 

// Shortcode Square Box
/*[squarebox image="image" title="title" url="#" target="blank"]*/
function squareboxarea($atts){
		extract( shortcode_atts(array(
			'image' => 'image',
			'title' => 'title',
			'url' => 'url',
			'target' => 'target'
		), $atts));
		
		
		return '
				<a href="'.$url.'">
					<div class="squarebox">
					<div class="squareicon"><img src="'.$image.'" /></div>
					<div class="squaretitle">'.$title.'</div>
					</div>		
				 </a>
		';
}
add_shortcode('squarebox','squareboxarea');

// Shortcode Perfect Box
/*[perfectbox image="image" title="title" description="description" url="#" target="blank"]*/
function perfectboxarea($atts){
		extract( shortcode_atts(array(
			'image' => 'image',
			'title' => 'title',
			'description' => 'description',
			'url' => 'url',
			'target' => 'target'
		), $atts));
		
		return '
			 <div class="perfectbox">
						<a href="'.$url.'" target="_'.$target.'"><div class="perfectborder">
							 <div class="perf-thumb"><img src="'.$image.'"/></div>
							 <div class="perf-title"><h3>'.$title.'</h3></div>
							 <div class="perf-description">'.$description.'</div>	
						</div></a>
			 </div>
		';
}
add_shortcode('perfectbox','perfectboxarea');

// Shortcode Block Box
/*[blockbox url="url" image="image" title="title" titlecolor="titlecolor" target="self"]*/
function blockboxset($atts){
		extract( shortcode_atts(array(
		'url' => 'url',
		'target' => 'target',
		'titlecolor' => 'titlecolor',
		'image' => 'image',
		'title' => 'title',
		), $atts));	
		
		return '
			<div class="blockbox">
				<a href="'.$url.'" target="_'.$target.'">
					<div class="infoblockthumb"><img src="'.$image.'" /></div>
					<div class="infoblocktitle"><h4 style="color:'.$titlecolor.';">'.$title.'</h4></div>
				</a>
			</div>
		';
}
add_shortcode('blockbox','blockboxset');

// Footer Menu
/*[footermenu]*/
function foot_menu($atts, $content = null) {
	extract(shortcode_atts(array(  
		'menu'            => '', 
		'container'       => 'div', 
		'container_class' => '', 
		'container_id'    => '', 
		'menu_class'      => 'footmenu', 
		'menu_id'         => '',
		'echo'            => true,
		'fallback_cb'     => 'wp_page_menu',
		'before'          => '',
		'after'           => '',
		'link_before'     => '',
		'link_after'      => '',
		'depth'           => 1,
		'walker'          => '',
		'theme_location'  => 'footer'), 
		$atts));
 
	return wp_nav_menu( array( 
		'menu'            => $menu, 
		'container'       => $container, 
		'container_class' => $container_class, 
		'container_id'    => $container_id, 
		'menu_class'      => $menu_class, 
		'menu_id'         => $menu_id,
		'echo'            => false,
		'fallback_cb'     => $fallback_cb,
		'before'          => $before,
		'after'           => $after,
		'link_before'     => $link_before,
		'link_after'      => $link_after,
		'depth'           => $depth,
		'walker'          => $walker,
		'theme_location'  => $theme_location));
}
//Create the shortcode
add_shortcode("footermenu", "foot_menu");