<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function custom_shortcode_newsletter($atts)
{
    /*$a = shortcode_atts( array(
    ), $atts );*/

    return we_newsletter();
}

function custom_shortcode_follow($atts){	
	return we_follow_us();
}

function custom_shortcode_other_posts($atts){
	return we_other_posts();
}

function custom_shortcode_videos($atts){
	$a = shortcode_atts( array(
		'limit' => -1,
		'orderby' => 'date'
    ), $atts );

	return we_videos($a['limit'], $a['orderby']);
}

function custom_shortcode_tags($atts){
	return we_tag_cloud();
}

function custom_shortcode_logos($atts){
	$a = shortcode_atts( array(
		'limit' => -1,
		'orderby' => 'date',		
    ), $atts );
	
	return get_last_entry('logos', $a['orderby'], $a['limit']);
}

function custom_shortcode_testimonials($atts){
	$a = shortcode_atts( array(
		'limit' => 20,
		'orderby' => 'rand',		
    ), $atts );
	
	return get_last_entry('testimonials', $a['orderby'], $a['limit']);
}

function custom_shortcode_steps($atts){
	$a = shortcode_atts( array(
		'excerpt' => 0,		
    ), $atts );
	
	return get_last_entry('steps', 'date', -1, $a['excerpt']);
}

function custom_shortcode_team($atts){
	$a = shortcode_atts( array(
		'slika' => '',
    ), $atts );
	
	return get_last_entry('team', 'date', -1, false, $a['slika']);
}

function custom_shortcode_faq($atts){
	return get_last_entry('faq', 'date', -1);
}

function custom_shortcode_categories( $atts )
{
	$a = shortcode_atts( array(
        'kategorija' => '',
    ), $atts );
	
	// arguments for function wp_list_categories
	$args = array( 
		'taxonomy' => $a['kategorija'],
		'title_li' => '',
		'echo' => false,
	);
 
	// We wrap it in unordered list 
	$html = '<ul>'; 
	$html .= wp_list_categories($args);
	$html .= '</ul>';
	
	return $html;

}

function custom_shortcode_sitemap( $atts ){
	return custom_sitemap();
}

function custom_shortcode_blog( $atts ){
	$a = shortcode_atts( array(
		'limit' => 3,
		'orderby' => 'date',
    ), $atts );
	
	return get_last_entry('blog', $a['orderby'], $a['limit']);
}

function custom_shortcode_contact( $atts ){
	return custom_widget_shortcode('contact');
}