Here is a PHP function :
public static function getMap($maps, $class = '')
{
global $wpdb;
$html = '<div class="jsDivCenter">';
if(count($maps)){
foreach ($maps as $key => $value) {
if($value[0] !== '' || $value[1] !== ''){
$sql = "SELECT id FROM {$wpdb->joomsport_maps} WHERE id=".intval($key);
if($wpdb->get_var($sql)){
if(JoomsportSettings::get('partdisplay_awayfirst',0) == 1){
$home_map = $value[1];
$away_map = $value[0];
}else{
$home_map = $value[0];
$away_map = $value[1];
}
$html .= '<div class="jsScoreDivMap '.$class.'">'.$home_map.JSCONF_SCORE_SEPARATOR.$away_map.'</div>';
}
}
}
}
$html .= '</div>';
return $html;
Here is the PHP code :
<?php
if ($rows->lists['maps'] && count($rows->lists['maps'])) {
echo "<center><font color='blue'>Maps</font></center>";
echo jsHelper::getMap($rows->lists['maps']);
}
?>
I would like this PHP code to display only the "map" with ID = 4 and not the entire list. How to do this ?
Thanks.
>Solution :
try this code:
<?php
if ($rows->lists['maps'] && count($rows->lists['maps'])) {
echo "<center><font color='blue'>Maps</font></center>";
$maparray = $rows->lists['maps'];
if (!empty($maparray[4])){
$newmap[4] = $maparray[4];
echo jsHelper::getMap($newmap);
}
}
?>