You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.9 KiB
PHP
103 lines
3.9 KiB
PHP
<?php
|
|
/*
|
|
Template Name: Trasmissione
|
|
Template Post Type: post, page, broadcast
|
|
*/
|
|
?>
|
|
<?php
|
|
$week = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato","Domenica"];
|
|
get_header();?>
|
|
|
|
<main>
|
|
<div class="container">
|
|
<div class="row">
|
|
<div id="primary" class="content-area col-md-9">
|
|
|
|
<?php
|
|
while (have_posts()) :
|
|
the_post();
|
|
?>
|
|
|
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
|
<header class="entry-header">
|
|
<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
|
|
</header><!-- .entry-header -->
|
|
<div class="entry-content">
|
|
<figure style="margin-bottom:2em; width:45%; padding:1em; float:right">
|
|
<?php echo get_the_post_thumbnail(get_the_ID(), 'full'); ?>
|
|
</figure>
|
|
<?php
|
|
the_content();
|
|
$on_air = get_post_meta(get_the_ID(), 'on_air_day_0', false);
|
|
$start_time = get_post_meta(get_the_ID(), 'on_air_start_0', false);
|
|
?>
|
|
<div class="on-air">
|
|
<?php /*Se $onair[0] non è valorizzato la trasmissione non ha diretta e quindi è conclusa */ ?>
|
|
<?php if (empty($on_air[0])) { ?>
|
|
<p style="color:#0bfafa">---> Trasmissione conclusa <---</p>
|
|
<?php } else { ?>
|
|
<p style="color:#0bfafa">---> In diretta ogni <?php echo $week[$on_air[0]-1]; ?> dalle ore <?php echo $start_time[0]; ?> <---</p>
|
|
<?php } ?>
|
|
</div>
|
|
<br>
|
|
<!-- Link all'archivio delle puntate -->
|
|
<?php
|
|
$category_id = get_post_meta(get_the_ID(), 'taxonomy_id', true);
|
|
$category_link = get_category_link( $category_id );
|
|
?>
|
|
<h6><a style="color:gold" href="<?php echo $category_link; ?>">[ Tutte le puntate ]</h6></a>
|
|
</div><!-- .entry-content -->
|
|
</article><!-- #post-<?php the_ID(); ?> -->
|
|
<div class="related-posts">
|
|
<h2>Ultime puntate e notizie</h2>
|
|
|
|
<?php
|
|
$cat_id = get_post_meta(get_the_ID(), 'taxonomy_id', true);
|
|
//$cat_id = get_the_category(get_the_ID());
|
|
|
|
/* echo '<pre>';
|
|
print_r($cat_id);
|
|
|
|
echo '</pre>';
|
|
*/
|
|
$last_posts = get_posts(
|
|
array(
|
|
'numberposts' => 3,
|
|
'category' => $cat_id
|
|
)
|
|
);
|
|
//echo '<pre>';
|
|
//print_r($last_posts);
|
|
//echo '</pre>';
|
|
foreach ($last_posts as $s_post) {
|
|
$american_data = explode(" ", $s_post->post_date);
|
|
$data_a = explode("-", $american_data[0]); ?>
|
|
<article>
|
|
<h3>
|
|
<a href="<?php echo get_permalink($s_post->ID); ?>" title="<?php echo $s_post->post_title; ?>"><?php echo $s_post->post_title; ?></a>
|
|
</h3>
|
|
<p class="data"><?php echo $data_a[2]."/".$data_a[1]."/".$data_a[0]; ?></p>
|
|
<?php echo get_the_post_thumbnail($s_post->ID, 'full'); ?>
|
|
<p class="content"><?php echo $s_post->post_content; ?></p>
|
|
</article>
|
|
<?php
|
|
}
|
|
// If comments are open or we have at least one comment, load up the comment template.
|
|
if (comments_open() || get_comments_number()) :
|
|
comments_template();
|
|
endif;
|
|
|
|
endwhile; // End of the loop.
|
|
?>
|
|
</div>
|
|
</div><!-- #primary -->
|
|
<!-- ho commentato questo perche' visualizzava male la sidebar <div id="secondary" class="col-md-3" role="complementary"> -->
|
|
<?php get_sidebar(); ?>
|
|
<!--</div><-->
|
|
</div><!-- .wrap -->
|
|
</div>
|
|
</main>
|
|
|
|
<?php
|
|
get_footer();
|