<?php
add_shortcode('button', 'button_handler');

function button_handler($atts, $content=null, $code="") {
	$class="";
	
	/* Size */
	if($atts["size"] == "small" || !isset($atts["size"])) {	
		$btn_type = "btn-1";
	} elseif ($atts["size"] == "big") {
		$btn_type = "btn-2";
	}
	$class.= $btn_type;	//btn-1
	
	/* Color */
	$color=$atts["color"];
	$background=$atts["background"];

	
	/* Target */
	$target=$atts["target"];
	if(!isset($atts["target"]) || $atts["target"]=="blank") {
		$target="_blank";
	} else {
		$target="Self";
	}
	
	/* Align */
	if($atts["align"] == "left" || !isset($atts["align"])) {
		$class.= " ".$btn_type."-align-left";
	} elseif($atts["align"] == "right") {
		$class.= " ".$btn_type."-align-right";
	}

	/* link */
	if(isset($atts["link"])) {
		$link = $atts["link"];
	} else {
		$link = "#";
	}

	$return = '<a href="'.$link.'" class="'.$class.'" style="background-color: #'.$background.'; " target="'.$target.'"><span style="color: #'.$color.';">'.$content.'</span></a>';
	
	return $return;
}

?>