hangar-wp-theme/caixes.php

228 lines
11 KiB
PHP

<li id="post-<?php the_ID(); ?>" <?php echo 'class ="boxentry ' . $tipus; if (in_category("destacado")) echo ' destacat'; echo '"'; ?>>
<?php if ((!$category) and ($tipus == 'pag')) : ?>
<!-- les pàgines fixes (no categories ni artistes) -->
<article class="not-category tipus-pag">
<div class="head-entry">
<h2 class="box <?php echo $tipus;?>">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title() ;?> </a>
</h2>
</div>
<div class="contingut plus">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('thumbnail'); ?>
</a>
<?php //the_excerpt(); ?>
<?php echo hangar_trim_excerpt(); ?>
</div>
<div class="boxpeu" >
<a href="<?php the_permalink(); ?>" class="peubox read-more" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img alt="enllaç" src="<?php echo get_template_directory_uri() . '/images/fletxalink.png';?>" /></a>
</div>
</article>
<?php elseif ((!$category) and (($tipus == 'art')) or ($tipus == 'obra')): ?>
<!-- els artistes -->
<article class="not-category tipus-art tipus-obra tipus-artistes">
<div class="head-entry">
<?php if (is_home()) : ?>
<span class='cat'>
<a href="<?php echo get_permalink(2);?>"><?php echo get_the_title(2);?></a>
</span>
<h2 class="box <?php echo $tipus;?>"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title() ;?> </a> </h2>
<?php else : ?>
<h3 class="box <?php echo $tipus;?>"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title() ;?> </a> </h3>
<?php endif;?>
</div>
<?php if ($tipus == 'art') :?>
<!-- es artiste -->
<?php if(get_post_meta($post->ID, 'autor_tipo_resid', true) && get_post_meta($post->ID, 'autor_data_resid', true)): ?>
<p class="meta box">
<?php echo __(get_post_meta($post->ID, 'autor_tipo_resid', true)) ?>
<br />
<?php echo __(get_post_meta($post->ID, 'autor_data_resid', true)) ?>
</p>
<?php else : ?>
<p class="meta box novista"></p>
<?php endif; ?>
<?php else : ?>
<p class="meta box"><?php echo get_post_meta($post->ID, 'data_obra', true) ?></p>
<?php endif; ?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="contingut">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('artists-thumb'); ?>
</a>
</div>
<?php else : ?>
<div class="contingut curt">
<img class="noimatge gran" width="200" height="230" title="imatge no disponible" alt="imatge no disponible" src="<?php echo get_template_directory_uri() .'/images/noimatgegran.jpg';?>" />
</div>
<?php endif; ?>
<div class="boxpeu" >
<?php // la fletxeta link al post/pàgina ?>
<a href="<?php the_permalink(); ?>" class="peubox read-more" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img alt="enllaç" src="<?php echo get_template_directory_uri() . '/images/fletxalink.png';?>" /></a>
<?php if (is_home()) : ?>
<?php // els quadrets link a la categoria pare ?>
<a href="<?php echo get_permalink(2); ?>" class="peudret" title="<?php echo get_the_title(2); ?>" rel="bookmark"><img alt="enllaç a la categoria" src="<?php echo get_template_directory_uri() . '/images/totslink.png';?>" /></a>
<?php endif; ?>
</div>
</article>
<?php elseif ((!$category) and ($tipus == 'equip')):
$lang = qtrans_getLanguage();
if($lang == 'ca'): $carrec = get_post_meta($post->ID, 'carrec', true);
elseif($lang == 'es'): $carrec = get_post_meta($post->ID, 'carrecES', true);
elseif($lang == 'en'): $carrec = get_post_meta($post->ID, 'carrecEN', true);
endif;
$email = get_post_meta($post->ID, 'email', true);
$telefon = get_post_meta($post->ID, 'telefon', true);
?>
<!-- EQUIP i MATRONAT -->
<article class="not-category tipus-eqip tipus-matronat">
<div class="head-entry"> <!-- els equips només són índex, no tenen enllça a pàgina ni peu-->
<h3 class="equip <?php echo $tipus;?>"><?php the_title() ;?> </h3>
<p class="carrec"><?php echo $carrec; //echo qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($carrec); ?> </p>
</div>
<p class="boxcurta"><?php echo $telefon; ?> </p>
<p class="meta box"><?php echo $email; ?> </p>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('thumbnail'); ?>
</a>
<?php else : ?>
<img class="noimatge gran" width="200" height="150" title="imatge no disponible" alt="imatge no disponible" src="<?php echo get_template_directory_uri() .'/images/noimatge.jpg';?>" />
<?php endif; ?>
<?php if (has_excerpt()) : ?>
<p class="excerptbox"><?php the_excerpt();?></p>
<?php else :?>
<div class="contingut curt"><?php echo hangar_trim_excerpt(); ?></div>
<?php endif; ?>
</article>
<?php elseif ((!$category) and ($tipus == 'desc')): ?>
<!-- els descarregables -->
<article class="not-category tipus-descarregables tipus-desc">
<div class="head-entry">
<?php if (is_home()) : ?>
<span class='cat'>
<a href="<?php echo get_permalink(136);?>"><?php echo get_the_title(136);?></a>
</span>
<h2 class="box <?php echo $tipus;?>"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title() ;?> </a> </h2>
<?php else : ?>
<h3 class="box <?php echo $tipus;?>"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title() ;?> </a> </h3>
<?php endif;?>
</div>
<div class="contingut llarg">
<?php the_content(); ?>
</div>
<!-- la fletxeta link al post/pàgina -->
<div class="boxpeu">
<a href="<?php the_permalink(); ?>" class="peubox read-more" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img alt="enllaç" src="<?php echo get_template_directory_uri() . '/images/fletxalink.png';?>" /></a>
<!-- els quadrets link a la categoria pare -->
<?php if (is_home()) : ?>
<a href="<?php echo get_permalink(136); ?>" class="peudret" title="<?php echo get_the_title(136); ?>" rel="bookmark"><img alt="enllaç a la categoria" src="<?php echo get_template_directory_uri() . '/images/totslink.png';?>" /></a> <?php ?>
<?php endif; ?>
</div>
</article>
<?php else :
// echo " category " . $category . " catt2 " . $catt2 . " category 0 " . $category[0]->term_id;?>
<!-- resta de categories -->
<article class="category">
<div class="head-entry">
<?php if (is_home()) : ?>
<span class="cat">
<a href="<?php echo get_category_link( $category[0]->term_id );?>"><?php echo $category[0]->name;?></a>
</span>
<h2 class="box <?php echo $tipus;?>"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo the_title();?> </a> </h2>
<?php else : ?>
<?php if (has_subcategories($catt2)) : ?>
<span class="cat"> <!-- atenció cal assingar cada post a la subcategoria, sinó sortirà la categoria pare -->
<a href="<?php echo get_category_link( $category[0]->term_id );?>"><?php echo $category[0]->name;?></a>
</span>
<h3 class="box <?php echo $tipus;?>"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo the_title();?> </a> </h3>
<?php else : ?>
<?php //echo get_permalink(); ?>
<h3 class="box nosub<?php echo $tipus;?>"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo the_title();?> </a> </h3>
<?php endif;?>
<?php endif; ?>
</div>
<?php
$lang = qtrans_getLanguage();
if($lang == 'ca' and (get_post_meta($post->ID, 'data_activitat', true) )):
?>
<p class="meta box">
<?php
echo get_post_meta($post->ID, 'data_activitat', true);
if (get_post_meta($post->ID, 'horari_activitat', true)) echo " / ".get_post_meta($post->ID, 'horari_activitat', true);
if (get_post_meta($post->ID, 'lloc_activitat', true)) echo " - ".get_post_meta($post->ID, 'lloc_activitat', true);
?>
</p>
<?php
elseif($lang == 'es' and (get_post_meta($post->ID, 'data_activitatES', true) )):
?>
<p class="meta box">
<?php
echo get_post_meta($post->ID, 'data_activitatES', true);
if (get_post_meta($post->ID, 'horari_activitat', true)) echo " / ".get_post_meta($post->ID, 'horari_activitat', true);
if (get_post_meta($post->ID, 'lloc_activitat', true)) echo " - ".get_post_meta($post->ID, 'lloc_activitat', true);
?>
</p>
<?php
elseif($lang == 'en' and (get_post_meta($post->ID, 'data_activitatEN', true) )):
?>
<p class="meta box">
<?php
echo get_post_meta($post->ID, 'data_activitatEN', true);
if (get_post_meta($post->ID, 'horari_activitat', true)) echo " / ".get_post_meta($post->ID, 'horari_activitat', true);
if (get_post_meta($post->ID, 'lloc_activitat', true)) echo " - ".get_post_meta($post->ID, 'lloc_activitat', true);
?>
</p>
<?php else: ?>
<p class="meta box novista"><?php // echo __('Publicat el ','hangar') . the_time('d F Y') ?></p>
<?php endif;?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="contingut">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('thumbnail'); ?>
</a>
</div>
<?php endif; ?>
<?php if (has_excerpt()) : ?>
<div class="contingut">
<p class="excerptbox">
<?php
// https://developer.wordpress.org/reference/functions/wp_trim_words/
echo wp_trim_words(get_the_excerpt(), 60,' <a href="'. get_permalink($post->ID) . '">[...]</a>')
?>
</p>
</div>
<?php else :?>
<div class="contingut curt">
<?php echo hangar_trim_excerpt(); ?>
</div>
<?php endif; ?>
<div class="boxpeu" >
<a href="<?php the_permalink(); ?>" class="peubox read-more" title="<?php printf( esc_attr__( 'Permalink to %s', 'hangar' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img alt="enllaç" src="<?php echo get_template_directory_uri() . '/images/fletxalink.png';?>" /></a>
<?php if (is_home()) : ?>
<!-- els quadrets link a la categoria pare -->
<a href="<?php echo get_category_link( $category[0]->term_id ); ?>" class="peudret" title="<?php echo $category[0]->name; ?>" rel="bookmark"><img alt="enllaç a la categoria" src="<?php echo get_template_directory_uri() . '/images/totslink.png';?>" /></a>
<?php endif;?>
</div>
<?php endif; ?>
</article>
</li>