File: /home/slyfwmm/incastiglionfiorentino/wp-content/themes/amplify/scheda_attivita.php
<?php
/**
* Template Name: Scheda AttivitÃ
*
* Template per mostrare scheda delle attivitÃ
*/
get_header(); ?>
<div id="main_container">
<!-- IE7 float fix --><!--[if lt IE 7]><span class="iefix">.</span><![endif]-->
<div class="main">
<div class="entries_full">
<div class="entry_full">
<div class="box_twothirds mt35 pr60">
<?php $count = 0; ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<!-- displays the blog posts -->
<?php $count++; if($count > 3) { $count = 1; } ?>
<h3 class="<?php if($count > 1) echo "mt25 "; ?>mb12"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<?php if(get_field('large_image_value') != NULL || get_field('fullsize_value') != NULL)
{ ?>
<div class="mag_blog"><!-- magnifying glass div -->
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php if(get_field('large_image_value') != NULL) {echo get_field('large_image_value');} else {echo get_field('fullsize_value');} ?>&h=213&w=600&zc=1" alt="<?php the_title(); ?>" /></a>
</div><!-- end magnifying glass div -->
<?php } ?>
<?php
$struttura_id=get_the_ID();
$metakey = 'id-galleria';
$t = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ORDER BY meta_value ASC", $struttura_id, $metakey) );
if ($t) {
foreach ($t as $s) {
if (($s != "") && ($s != " ") && ($s != NULL))
{
$gallery = "[nggallery id=" . $s . "]";
echo do_shortcode($gallery);
}
}
}
?>
<?php
$metakey = 'logo';
$logo = "";
$t = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ORDER BY meta_value ASC", $struttura_id, $metakey) );
if ($t) {
foreach ($t as $s) {
if (($s != "") && ($s != " ") && ($s != NULL))
{
$tit = get_the_title();
$logo = "<div id=\"logo-struttura\">" . "<img src=\"". $s . "\" alt=\"" . $tit . " - Castiglion Fiorentino - Arezzo\" title=\"" . $tit . " - Castiglion Fiorentino - Arezzo\" />" . "</div>";
}
}
}
if($logo != "")
{ ?>
<div id="logo-info-box">
<?php echo $logo;
}else{?>
<div id="no-logo-info-box">
<?php }?>
<div id="info-struttura">
<?php
$indirizzo = "";
$metakey = 'indirizzo';
$t = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ORDER BY meta_value ASC", $struttura_id, $metakey) );
if ($t) {
foreach ($t as $s) {
if (($s != "") && ($s != " ") && ($s != NULL))
{
echo "<div style=\"float: left; margin-right: 6px; margin-top: -3px;\"><img src=\"" . get_template_directory_uri() ."/images/address.jpg\" /></div><div class=\"meta\" style=\"margin-bottom: 20px;\">" . $s . "</div>";
$indirizzo = $s;
}
}
}
$metakey = 'telefono';
$t = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ORDER BY meta_value ASC", $struttura_id, $metakey) );
if ($t) {
foreach ($t as $s) {
if (($s != "") && ($s != " ") && ($s != NULL))
{
echo "<div style=\"float: left; margin-right: 6px; margin-top: -3px;\"><img src=\"" . get_template_directory_uri() ."/images/phone.jpg\" /></div><div class=\"meta\" style=\"margin-bottom: 20px;\">" . $s . "</div>";
}
}
}
$metakey = 'telefono_secondario';
$t = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ORDER BY meta_value ASC", $struttura_id, $metakey) );
if ($t) {
foreach ($t as $s) {
if (($s != "") && ($s != " ") && ($s != NULL))
{
echo "<div style=\"float: left; margin-right: 6px; margin-top: -3px;\"><img src=\"" . get_template_directory_uri() ."/images/phone.jpg\" /></div><div class=\"meta\" style=\"margin-bottom: 20px;\">" . $s . "</div>" ;
}
}
}
$metakey = 'sito_web';
$t = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ORDER BY meta_value ASC", $struttura_id, $metakey) );
if ($t) {
foreach ($t as $s) {
if(($s != "") && ($s != " ") && ($s != NULL))
{
echo "<div style=\"float: left; margin-right: 6px; margin-top: -3px;\"><img src=\"" . get_template_directory_uri() ."/images/web.jpg\" /></div><div class=\"meta\" style=\"margin-bottom: 20px;\"><a href=\"" . $s . "\" target=\"blank\" rel=\"nofollow\">" .$s. "</a></div>";
}
}
}
?>
</div>
</div>
<div class="bar mt25 mb30"></div>
<div id="descrizione-struttura">
<h5> </h5>
<?php the_content(); ?>
</div>
<div class="bar mt25 mb30"></div>
<?php
$metakey = 'id-mappa';
$map = "";
$t = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ORDER BY meta_value ASC", $struttura_id, $metakey) );
if ($t) {
foreach ($t as $s) {
if(($s != "") && ($s != " ") && ($s != NULL))
{
$map = "[mappress mapid=\"".$s."\"]";
}
}
}
if($map != "")
{ ?>
<h5></h5><?php
echo do_shortcode($map); ?>
<div class="bar mt25 mb30"></div>
<?php
}
?>
<?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'amplify' ), 'after' => '' ) ); ?>
<?php endwhile; ?>
</div>
<!-- Begin Sidebar -->
<?php
if(get_field('custom_sidebar_value') != NULL)
{include get_field('custom_sidebar_value');}
else {include('sidebar.php');} ?>
<!-- end sidebar -->
<div class="clear"></div>
</div><!-- end div.entry -->
</div><!-- end div.entries -->
<div class="clear"></div>
</div><!-- end div#main -->
<div class="clear"></div>
</div><!-- end div#main_container-->
<?php get_footer(); ?>