1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function avia_portfolio_meta($id = false, $portfolio_keys = false)
{
	if(!$id) $id = get_the_ID();
	if(!$id) return false;
	
	$output = "";
	$metas = avia_post_meta($id);
	
	if(!$portfolio_keys)
	{
		$portfolio_keys = avia_get_option('portfolio-meta', array(array('meta'=>'Skills Needed'), array('meta'=>'Client'), array('meta'=>'Project URL')));
	}
	else
	{
		$portfolio_keys = array(array('meta'=>$portfolio_keys));
	}
	
	$p_metas = array();
	foreach($metas as $key =>$meta)
	{
		if(strpos($key,'portfolio-meta-') !== false)
		{
			$p_metas[] = $meta;
		}
	}
	
	$counter = 0;
	foreach($portfolio_keys as $key)
	{
		if(!empty($p_metas[$counter]))
		{
			//convert urls
			if(avia_portfolio_url($p_metas[$counter]))
			{
				$linktext = $p_metas[$counter];
				if(strlen($linktext) > 50) $linktext = __('Link','avia_framework');
				$p_metas[$counter] = "<a href='".$p_metas[$counter]."'>".$linktext."</a>";
			}
			
			$output .= "<li><strong class='portfolio-meta-key'>".$key['meta'].":</strong> <div class='portfolio-meta-value'>".$p_metas[$counter]."</div></li>";
		}
		$counter++;
	}
	
	if($output) $output = "<ul class='portfolio-meta-list'>".$output."</ul>";
	return $output;
}