Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » WordPress »

Google Maps plugin terceros

Estas en el tema de Google Maps plugin terceros en el foro de WordPress en Foros del Web. Buenos días, soy nuevo en el foro y en esto del PHP, a ver si me podeis ayudar: Tengo el siguiente código: Código PHP: <?php ...
  #1 (permalink)  
Antiguo 11/03/2013, 07:05
 
Fecha de Ingreso: marzo-2013
Ubicación: Esporles
Mensajes: 1
Antigüedad: 11 años, 1 mes
Puntos: 0
Pregunta Google Maps plugin terceros

Buenos días, soy nuevo en el foro y en esto del PHP, a ver si me podeis ayudar:

Tengo el siguiente código:
Código PHP:
<?php
function get_category_home()
{
    global 
$wpdb;

    
$catsql "select distinct c.term_id, c.* from $wpdb->terms c,$wpdb->term_taxonomy tt where tt.term_id=c.term_id and tt.taxonomy ='".CUSTOM_CATEGORY_TYPE1."' order by c.term_id,c.name";
    
$catinfo $wpdb->get_results($catsql);
    
$cat_content_info = array();
    
$cat_name_info = array();
    foreach (
$catinfo as $catinfo_obj)
    { 
        global 
$wpdb;
        
$term_id $catinfo_obj->term_id;
        
$name $catinfo_obj->name;
        
$column_term $wpdb->get_results("SELECT term_icon FROM $wpdb->terms");

        
$term_parent = @$catinfo_obj->parent;
        if(!isset(
$term_icon))
            {if (
$name == 'Cat1')
                            
$term_icon =  get_bloginfo('template_directory').'/library/map/icons/pin.png';
            elseif (
$name == 'Cat2')
                            
$term_icon =  get_bloginfo('template_directory').'/library/map/icons/gym.png';
            elseif (
$name == 'Cat3')
                            
$term_icon =  get_bloginfo('template_directory').'/library/map/icons/gym.png';}
        if(
$term_id)
        {
            
$content_data = array();
            
$my_post_type CUSTOM_POST_TYPE1;

            
$sql "select p.* from $wpdb->posts p where p.post_type = \"$my_post_type\" and p.post_status = 'publish' and p.ID in (select tr.object_id from $wpdb->term_relationships tr join $wpdb->term_taxonomy t on t.term_taxonomy_id=tr.term_taxonomy_id where t.term_id=\"$term_id\" )";
        
            
$postinfo $wpdb->get_results($sql);
        
            
$data_arr = array();
            if(
$postinfo)
            { 
                
$srcharr = array("'");
                
$replarr = array("\'");
                foreach(
$postinfo as $postinfo_obj)
                {
                    
$ID $postinfo_obj->ID;
                    
$title str_replace($srcharr,$replarr,($postinfo_obj->post_title));
                    
$plink get_permalink($postinfo_obj->ID);
                    
$lat get_post_meta($ID,'geo_latitude',true);
                    
$lng get_post_meta($ID,'geo_longitude',true);
                    
$address str_replace($srcharr,$replarr,(get_post_meta($ID,'address',true)));
                    
$contact str_replace($srcharr,$replarr,(get_post_meta($ID,'contact',true)));
                    
$timing str_replace($srcharr,$replarr,(get_post_meta($ID,'timing',true)));
                    
                    
$pimgarr =  bdw_get_images_with_info($ID,'thumb');                
                    
$attachment_id $pimgarr[0]['id'];
                    
$alt get_post_meta($attachment_id'_wp_attachment_image_alt'true);
                    
$attach_data get_post($attachment_id);
                    
$ititle str_replace($srcharr,$replarr,$attach_data->post_title);
                    if(
$ititle ==''){ $ititle str_replace($srcharr,$replarr,$postinfo_obj->post_title); }
                    if(
$alt ==''){ $alt str_replace($srcharr,$replarr,$postinfo_obj->post_title); }
    

                    
$post_img bdw_get_images_with_info($postinfo_obj->ID,'thumb');
                    
$thumb $post_img[0]['file'];
                    
$attachment_id $post_img[0]['id'];
                    
$attach_data get_post($attachment_id);
                    
$img_title $attach_data->post_title;
                    
$img_alt get_post_meta($attachment_id'_wp_attachment_image_alt'true);
                    if(
$img_title ==''){ $img_title $postinfo_obj->post_title; }
                    if(
$img_alt ==''){ $img_alt $postinfo_obj->post_title; }
      
                    if(
$thumb ==''){
                    
$thumb get_template_directory_uri()."/images/no-image.png";
                    }

                     
$pimg get_post_meta($ID,'company_logo',$single=true);
                    if(!
$pimg):
                        
$pimg get_template_directory_uri()."/images/no-image.png";
                    endif;    
                    
$more VIEW_MORE_DETAILS_TEXT;

                    if(
$lat && $lng)
                    { 
                        
$retstr ="{";
                        
$retstr .= "'name':'$title',";
                        
$retstr .= "'location': [$lat,$lng],";
                        
$retstr .= "'message':'<div class=\"forrent\"><img src=\"$thumb\" width=\"125\" height=\"75\" alt=\"\" />";
                        
$retstr .= "<h6><a href=\"$plink\" class=\"ptitle\" style=\"color:#444444;font-size:14px;\"><span>$title</span></a></h6>";
                        if(
$address){$retstr .= "<span style=\"font-size:10px;\">$address</span>";}
                        
$retstr .= "<p class=\"link-style1\"><a href=\"$plink\" class=\"ptitle\">$more</a></p>";
                        
$retstr .= "',";
                        
$retstr .= "'icons':'$term_icon',";
                        
$retstr .= "'pid':'$ID'";
                        
$retstr .= "}";
                        
$content_data[] = $retstr;

                    }
                }
                if(
$content_data)
                {
                    
$arrsrch = array("'");
                    
$arrrep = array('');
                    
$catname strtolower(str_replace($arrsrch,$arrrep,$name));
                    
$cat_content_info[]= "'$catname':[".implode(',',$content_data)."]";
                    
$cat_name_info[] = array($name,$catname,$term_icon,$term_parent);
                }
            }            
        }        
    }
    if(
$cat_content_info)
    {
        return array(
$cat_name_info,implode(',',$cat_content_info),$term_parent);
        
//return $term_parent;
    
}
}

    
$width 947;
    
$heigh 600;
    
$catarr get_category_home();
    
$catname_arr $catarr[0];
    
$catinfo_arr $catarr[1];
    
?>
Quiero que, cuando la etiqueta $name varie me cambiase el $term_icon para mostrar un marcador distinto en según las categorias.

Gracias por adelantado.

Etiquetas: dudas, errores, ideas, mapas, maps, marcadores, php, plugin, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:19.