changed excerpt in category when long length goes out of the box, specially in arxives category

This commit is contained in:
jorge-vitrubio 2022-07-19 00:27:21 +02:00
parent d8adf6c3a6
commit b2c2e3cd65
3 changed files with 239 additions and 351 deletions

View File

@ -1,180 +1,209 @@
<li id="post-<?php the_ID(); ?>" <?php echo 'class ="boxentry ' . $tipus; if (in_category("destacado")) echo ' destacat'; echo '"'; ?>>
<!-- <?php echo $category; ?> -->
<!-- <?php echo $tipus; ?> -->
<?php //echo $category; ?>
<?php //echo $tipus; ?>
<!-- les pàgines fixes (no categories ni artistes) -->
<?php if ((!$category) and ($tipus == 'pag')) : ?>
<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 $contingut = get_the_content_with_formatting(); //funció que està a functions.php permet mostrar links i html del contingut, client ho volia ?>
<div class="contingut plus">
<?php echo $contingut; ?>
</div>
<div class="boxpeu" >
<a href="<?php the_permalink(); ?>" class="peubox" 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>
<!-- els artistes -->
<?php elseif ((!$category) and (($tipus == 'art')) or ($tipus == 'obra')): ?>
<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;?>
<?php $contingut = get_the_content_with_formatting(); //funció que està a functions.php permet mostrar links i html del contingut, client ho volia ?>
<div class="contingut plus">
<?php echo $contingut; ?>
</div>
<?php if ($tipus == 'art') :
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() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('artists-thumb'); ?>
</a>
<?php else : ?>
<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';?>" />
<?php endif; ?>
<div class="boxpeu" >
<!-- la fletxeta link al post/pàgina -->
<a href="<?php the_permalink(); ?>" class="peubox" 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_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>
<a href="<?php the_permalink(); ?>" class="peubox" 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>
<!-- els artistes -->
<?php elseif ((!$category) and (($tipus == 'art')) or ($tipus == 'obra')): ?>
<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') :
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; ?>
</div>
<!-- EQUIP -->
<?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);
<?php else : ?>
<p class="meta box"><?php echo get_post_meta($post->ID, 'data_obra', true) ?></p>
<?php endif; ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('artists-thumb'); ?>
</a>
<?php else : ?>
<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';?>" />
<?php endif; ?>
<div class="boxpeu" >
<!-- la fletxeta link al post/pàgina -->
<a href="<?php the_permalink(); ?>" class="peubox" 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_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>
<!-- EQUIP -->
<?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);
?>
<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 echo get_the_excerpt(); ?></p>
<?php else :?>
<div class="contingut curt"><?php echo custom_wp_trim_excerpt(); ?></div>
<?php endif; ?>
$telefon = get_post_meta($post->ID, 'telefon', true);
?>
<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>
<!-- els descarregables -->
<?php elseif ((!$category) and ($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" 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>
<!-- resta de categories -->
<?php else :
// echo " category " . $category . " catt2 " . $catt2 . " category 0 " . $category[0]->term_id;?>
<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();
<?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 echo get_the_excerpt(); ?></p>
<?php else :?>
<div class="contingut curt"><?php echo custom_wp_trim_excerpt(); ?></div>
<?php endif; ?>
<!-- els descarregables -->
<?php elseif ((!$category) and ($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" 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>
<!-- resta de categories -->
<?php else :
// echo " category " . $category . " catt2 " . $catt2 . " category 0 " . $category[0]->term_id;?>
<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() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('thumbnail'); ?>
</a>
<?php else : ?>
<!--<img class="noimatge" 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 echo get_the_excerpt(); ?></p>
<?php else :?>
<div class="contingut curt"><?php echo custom_wp_trim_excerpt(); ?></div>
<?php endif; ?>
<div class="boxpeu" >
<a href="<?php the_permalink(); ?>" class="peubox" 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; ?>
?>
<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;?>
</li><!-- post .hentry -->
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('thumbnail'); ?>
</a>
<?php endif; ?>
<?php
if (has_excerpt()) : ?>
<p class="excerptbox">
<?php
// echo get_the_excerpt();
// 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>
<?php else :?>
<div class="contingut curt"><?php echo custom_wp_trim_excerpt(); ?></div>
<?php endif; ?>
<div class="boxpeu" >
<a href="<?php the_permalink(); ?>" class="peubox" 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; ?>
</li><!-- post .hentry -->

View File

@ -1,13 +1,13 @@
<?php
<?php
/**
* Template Name: Category ample
*
* Seccions de categories amd presentaçio de contingut ample.
* @link http://themehybrid.com/themes/hybrid/page-templates/categories
*
* @package Hangar
* @subpackage Template
*/
* Template Name: Category ample
*
* Seccions de categories amd presentaçio de contingut ample.
* @link http://themehybrid.com/themes/hybrid/page-templates/categories
*
* @package Hangar
* @subpackage Template
*/
get_header(); ?>
@ -19,44 +19,46 @@ get_header(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class("boxentry"); ?>>
<div class="entry-content">
<?php echo '<h2 class="box index">';
echo single_cat_title( '', false ) ; echo '</h2>' ; ?>
<?php $category_description = category_description();
if ( ! empty( $category_description ) ) :
echo '<div class="descseccio">'. category_description(). '</div>';
endif;
?>
echo single_cat_title( '', false ) ; echo '</h2>' ; ?>
<?php $category_description = category_description();
if ( ! empty( $category_description ) ) :
echo '<div class="descseccio">'. category_description(). '</div>';
endif;
?>
</div><!-- .entry-content -->
</div><!-- post .boxentry -->
</div><!-- .indexall.wide -->
<?php $catt2 = get_query_var('cat'); ?>
</div><!-- .indexall.wide -->
<?php $catt2 = get_query_var('cat'); ?>
<div id="content" class="indexall fills">
<ul>
<ul>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php $tipus = 'catt';
$category = get_the_category();
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$tipus = 'catt';
$category = get_the_category();
?>
<?php include(TEMPLATEPATH . "/caixes.php"); ?>
<?php include(TEMPLATEPATH . "/caixes.php"); ?>
<?php endwhile; ?>
</ul>
<?php wp_pagenavi(); /* kriesi_pagination();*/?>
<?php else: ?>
<?php endwhile; ?>
<p class="no-data">
<?php _e( 'Apologies, but no results were found.', 'hangar' ); ?>
</p><!-- .no-data -->
</ul>
</div><!-- .indexall.fills -->
<?php wp_pagenavi(); /* kriesi_pagination();*/?>
<?php else: ?>
<p class="no-data">
<?php _e( 'Apologies, but no results were found.', 'hangar' ); ?>
</p><!-- .no-data -->
</div><!-- .indexall.fills -->
<?php endif; ?>
<?php endif; ?>
</div><!-- .indexall.fills -->
</div><!--end #main-->
<?php get_footer(); ?>

View File

@ -1,4 +1,4 @@
<?php
<?php
//wp_set_password( 'testhangar', 1 );
@ -28,123 +28,29 @@ require_once(THEMELIB . '/breadcrumb.php');
// Create custom posts and custom fields
require_once(THEMELIB . '/custom-posts.php');
function new_excerpt_length($length) {
function hangar_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'new_excerpt_length');
add_filter('excerpt_length', 'hangar_excerpt_length');
function new_excerpt_more($more) {
function hangar_excerpt_more($more) {
global $post;
return '<a href="'. get_permalink($post->ID) . '"> [...]</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
add_filter('excerpt_more', 'hangar_excerpt_more');
// custom login screen i peu de l'admin
function custom_login() {
//echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/custom-login/custom-login.css" />';
// time stamp for caching
// https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2056
echo '<link rel="stylesheet" type="text/css" href="'. get_template_directory_uri() .'/custom-login/custom-login.css" />';
}
add_action('login_head', 'custom_login');
//function change_wp_login_url() {
//echo bloginfo('url');
//}
//add_filter('login_headerurl', 'change_wp_login_url');
//function change_wp_login_title() {
//echo 'Powered by ' . get_option('blogname');
//}
//add_filter('login_headertitle', 'change_wp_login_title');
function remove_footer_admin () {
echo 'Custom text | Copyright &copy; message';
}
add_filter('admin_footer_text', 'remove_footer_admin');
// THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA
function custom_controls() {
// echo '<style type="text/css">
// label.lateral{width: 100px;}
// input.lateral{width: 150px; border-color: #ddd;}
// .petit {width: 20px!important;}
// label.dd{float:left; width:250px;}
// input.dd{width:450px;}
// </style>';
}
add_action('admin_head', 'custom_controls');
/* create calendar event when saving post with dates */
// function create_event( $post_id ) {
//
// // If this is just a revision, don't send the email.
// if ( wp_is_post_revision( $post_id ) )
// return;
//
// $myPost = get_post($post_id);
// if (has_category(array('news', 'activitats-dels-residents'), $post_id) &&
// !$update &&
// $myPost->post_modified_gmt == $myPost->post_date_gmt) {
//
// //The URL that we want to send a PUT request to.
// $uid = get_the_guid( $post_id );
// $url = 'https://cloud.hangar.org/remote.php/dav/calendars/hangar/hangar_activitats/neu.ics';
// $headers = array('Content-Type: text/calendar', 'charset=utf-8');
// $userpwd = 'hangar:AV63xlklCuOJgYTnHz5smX4chiAaDpJo';
// $description = get_the_content( $post_id );
// $summary = get_the_title( $post_id );
// $tstart = gmdate("Ymd\THis\Z", strtotime("-2 days"));
// $tend = gmdate("Ymd\THis\Z", strtotime("-2 days"));
// $tstamp = gmdate("Ymd\THis\Z");
//
// // vcalendar
// $body = 'BEGIN:VCALENDAR
// VERSION:2.0
// BEGIN:VEVENT
// DTSTAMP:$tstamp
// DTSTART:$tstart
// DTEND:$tend
// UID:$uid
// DESCRIPTION:$description
// LOCATION:Hangar
// SUMMARY:$summary
// END:VEVENT
// END:VCALENDAR';
//
// //Initiate cURL
// $ch = curl_init($url);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// curl_setopt($ch, CURLOPT_USERPWD, $userpwd);
// //curl_setopt($ch, CURLOPT_PUT, true);
// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
// curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
//
// //Execute the request.
// $response = curl_exec($ch);
// curl_close($ch);
//
// // send confirmation mail
// $post_title = $summary;
// $post_excerpt = $description;
// $post_url = get_permalink( $post_id );
// $subject = 'A new EVENT post has been saved';
//
// $message = "A new post has been created on your website:\n\n";
// $message .= $post_title . ": " . $post_url . "\n\n";
// $message .= $post_excerpt . "\n\n";
// $message .= $uid . "\n\n";
// $message .= print_r($response);
//
// // Send email to admin.
// wp_mail( 'gerald@hangar.org', $subject, $message );
// }
// }
// add_action( 'save_post', 'create_event', 10, 3 );
//per imprimir el content sense que ens tregui l'html
function get_the_content_with_formatting ($more_link_text = '(...)', $stripteaser = 0, $more_file = '') {
@ -154,24 +60,6 @@ function get_the_content_with_formatting ($more_link_text = '(...)', $striptease
$content = substr($content, 0,400);
return $content;
}
//per imprimir l'excerpt indicant un nombre de caràcters màxim
// function the_excerpt_max_charlength($charlength) {
// $excerpt = get_the_excerpt();
// $charlength++;
// if(strlen($excerpt)>$charlength) {
// $subex = substr($excerpt,0,$charlength-5);
// $exwords = explode(" ",$subex);
// $excut = -(strlen($exwords[count($exwords)-1]));
// if($excut<0) {
// echo substr($subex,0,$excut);
// } else {
// echo $subex;
// }
// echo "[...]";
// } else {
// echo $excerpt;
// }
// }
//afegir estils a l'editor
@ -248,7 +136,7 @@ function has_subcategories($catt)
endif;
}
//contruim un panell de control a l'administració per a que vegin les que estan marcades per a sortir a la home
//construim un panell de control a l'administració per a que vegin les que estan marcades per a sortir a la home
function menu_control_home(){
add_menu_page( "Control Home","Control Home", "add_users", "control_home", "control_home", "", 6 );
}
@ -374,37 +262,6 @@ class my_Walker_Nav_Menu extends Walker_Nav_Menu {
<?php
/* Code that preserves HTML formating to the automatically generated Excerpt. */
/* Also modifies the default excerpt_length and excerpt_more filters. */
/*function custom_wp_trim_excerpt($text) {
$raw_excerpt = $text;
if ( '' == $text ) {
$text = get_the_content('');
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]&gt;', $text);
//Add the allowed HTML tags separated by a comma.
$allowed_tags = '<p>,<a>,<em>,<strong>';
$text = strip_tags($text, $allowed_tags);
//Change the excerpt word count.
$excerpt_word_count = 60;
$excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);
//Change the excerpt ending.
$excerpt_end = ' <a href="'. get_permalink($post->ID) . '">' . '&raquo; Continue Reading.' . '</a>';
$excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);
$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
if ( count($words) > $excerpt_length ) {
array_pop($words);
$text = implode(' ', $words);
$text = $text . $excerpt_more;
} else {
$text = implode(' ', $words);
}
}*/
// https://stackoverflow.com/questions/15283948/wordpress-html-tags-strip-on-manual-excerpt
function custom_wp_trim_excerpt($text='') {
@ -429,7 +286,7 @@ if ( '' == $text ) {
$excerpt_word_count = 200; /*** MODIFY THIS. change the excerpt word count to any integer you like.***/
$excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);
$excerpt_end = '[...]'; /*** MODIFY THIS. change the excerpt endind to something else.***/
$excerpt_end = '<a href="'. get_permalink($post->ID) . '"> [...]</a>'; /*** MODIFY THIS. change the excerpt endind to something else.***/
$excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);
$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);