|
|
@ -5,7 +5,42 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
$week = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato","Domenica"];
|
|
|
|
|
|
|
|
|
|
|
|
function create_onair_banner() {
|
|
|
|
|
|
|
|
$week = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato","Domenica"];
|
|
|
|
|
|
|
|
$content = $day = $cadence = $start_time = "";
|
|
|
|
|
|
|
|
$day = get_post_meta(get_the_ID(), 'on_air_day_0', true);
|
|
|
|
|
|
|
|
if (empty($day)) {
|
|
|
|
|
|
|
|
$content .= '<p style="color:#0bfafa">---> Trasmissione conclusa <---</p>';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$x = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
|
|
|
$start_time = get_post_meta(get_the_ID(), 'on_air_start_'.$x, true);
|
|
|
|
|
|
|
|
$cadence = get_post_meta(get_the_ID(), 'on_air_cadence_'.$x, true);
|
|
|
|
|
|
|
|
$litteral_day = $week[((int)$day) - 1];
|
|
|
|
|
|
|
|
switch((int) $cadence) {
|
|
|
|
|
|
|
|
case 2: //ogni 2 settimane
|
|
|
|
|
|
|
|
case 3: //ogni 3 settimane
|
|
|
|
|
|
|
|
case 4: //ogni 4 settimane
|
|
|
|
|
|
|
|
$text = "$cadence $litteral_day";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5: //una volta al mese
|
|
|
|
|
|
|
|
$start_date = get_post_meta(get_the_ID(), 'on_air_start_date_'.$x, true);
|
|
|
|
|
|
|
|
$day_of_the_month = which_day_of_the_month(new DateTime($start_date));
|
|
|
|
|
|
|
|
$text = "{$day_of_the_month}a $litteral_day del mese";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: //settimanale e altro non gestito (errori, etc.)
|
|
|
|
|
|
|
|
$text = "$litteral_day";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$content .= '<p style="color:#0bfafa">---> In diretta ogni '.$text.' dalle ore '.$start_time.' <---</p>';
|
|
|
|
|
|
|
|
$x = $x + 1;
|
|
|
|
|
|
|
|
$day = get_post_meta(get_the_ID(), 'on_air_day_'.$x, true);
|
|
|
|
|
|
|
|
} while (!empty($day));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $content;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get_header();?>
|
|
|
|
get_header();?>
|
|
|
|
|
|
|
|
|
|
|
|
<main>
|
|
|
|
<main>
|
|
|
@ -13,10 +48,10 @@ get_header();?>
|
|
|
|
<div class="row">
|
|
|
|
<div class="row">
|
|
|
|
<div id="primary" class="content-area col-md-9">
|
|
|
|
<div id="primary" class="content-area col-md-9">
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
while (have_posts()) :
|
|
|
|
while (have_posts()) :
|
|
|
|
the_post();
|
|
|
|
the_post();
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
|
|
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
|
|
|
<header class="entry-header">
|
|
|
|
<header class="entry-header">
|
|
|
@ -26,49 +61,31 @@ get_header();?>
|
|
|
|
<figure style="margin-bottom:2em; width:45%; padding:1em; float:right">
|
|
|
|
<figure style="margin-bottom:2em; width:45%; padding:1em; float:right">
|
|
|
|
<?php echo get_the_post_thumbnail(get_the_ID(), 'full'); ?>
|
|
|
|
<?php echo get_the_post_thumbnail(get_the_ID(), 'full'); ?>
|
|
|
|
</figure>
|
|
|
|
</figure>
|
|
|
|
<?php
|
|
|
|
<?php the_content(); ?>
|
|
|
|
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">
|
|
|
|
<div class="on-air">
|
|
|
|
<?php /*Se $onair[0] non è valorizzato la trasmissione non ha diretta e quindi è conclusa */ ?>
|
|
|
|
<?php /*Se $onair[0] non è valorizzato la trasmissione non ha diretta e quindi è conclusa */ ?>
|
|
|
|
<?php if (empty($on_air[0])) { ?>
|
|
|
|
<?php echo create_onair_banner(); ?>
|
|
|
|
<p style="color:#0bfafa">---> Trasmissione conclusa <---</p>
|
|
|
|
</div>
|
|
|
|
<?php } else { ?>
|
|
|
|
<br>
|
|
|
|
<p style="color:#0bfafa">---> In diretta ogni <?php echo $week[$on_air[0]-1]; ?> dalle ore <?php echo $start_time[0]; ?> <---</p>
|
|
|
|
<!-- Link all'archivio delle puntate -->
|
|
|
|
<?php } ?>
|
|
|
|
<?php
|
|
|
|
</div>
|
|
|
|
$category_id = get_post_meta(get_the_ID(), 'taxonomy_id', true);
|
|
|
|
<br>
|
|
|
|
$category_link = get_category_link( $category_id );
|
|
|
|
<!-- Link all'archivio delle puntate -->
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
<h6><a style="color:gold" href="<?php echo $category_link; ?>">[ Tutte le puntate ]</h6></a>
|
|
|
|
$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 -->
|
|
|
|
</div><!-- .entry-content -->
|
|
|
|
</article><!-- #post-<?php the_ID(); ?> -->
|
|
|
|
</article><!-- #post-<?php the_ID(); ?> -->
|
|
|
|
<div class="related-posts">
|
|
|
|
<div class="related-posts">
|
|
|
|
<h2>Ultime puntate e notizie</h2>
|
|
|
|
<h2>Ultime puntate e notizie</h2>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
$cat_id = get_post_meta(get_the_ID(), 'taxonomy_id', true);
|
|
|
|
$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(
|
|
|
|
$last_posts = get_posts(
|
|
|
|
array(
|
|
|
|
array(
|
|
|
|
'numberposts' => 3,
|
|
|
|
'numberposts' => 3,
|
|
|
|
'category' => $cat_id
|
|
|
|
'category' => $cat_id
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
//echo '<pre>';
|
|
|
|
|
|
|
|
//print_r($last_posts);
|
|
|
|
|
|
|
|
//echo '</pre>';
|
|
|
|
|
|
|
|
foreach ($last_posts as $s_post) {
|
|
|
|
foreach ($last_posts as $s_post) {
|
|
|
|
$american_data = explode(" ", $s_post->post_date);
|
|
|
|
$american_data = explode(" ", $s_post->post_date);
|
|
|
|
$data_a = explode("-", $american_data[0]); ?>
|
|
|
|
$data_a = explode("-", $american_data[0]); ?>
|
|
|
|