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.

74 lines
3.0 KiB
PHTML

2 years ago
<?php
function rwt_broadcast_list()
{
global $wpdb;
$broadcast_post = array(
2 years ago
'numberposts' => -1,
'post_type' => 'broadcast',
'orderby' => 'title',
'order' => 'asc',
/* 'exclude' => array(
'key'=> '_wp_page_template',
'value' => 'old_broadcast_template.php',
'compare' => '!='
)*/
2 years ago
);
$broadcast = get_posts($broadcast_post);
//'<pre>';
//var_dump($broadcast);
//echo '</pre>';
$attive = array();
$concluse = array();
foreach ($broadcast as $post) {
$on_air_day = get_post_meta($post->ID, 'on_air_day_0', false);
2 years ago
$on_air = empty($on_air_day[0]) ? false : true;
if ($on_air) {
array_push($attive,$post);
} else {
array_push($concluse,$post);
}
}
2 years ago
$content = '<div align="center">[ <a href="#attive">Attive</a> ] [ <a href="#concluse">Concluse</a> ]</div>';
echo $content;
$content = '<a style="color:Gold" name="attive"><h4 style="color:Gold">[[[ Attive ]]] </h4>';
$content .= "<div class='broadcast-list'>\n";
foreach ($attive as $post) {
$content .= '<div class="single-broadcast">';
//$content .= '" style="background:url(\''.$post['thumb_url'].'\') no-repeat center center;background-size:cover;">';
//$content .= '<p class="img-url">'.$post['thumb_url'].'</p>';
$content .= '<a href="'.get_permalink($post->ID).'" title="'.$post->post_title.'">';
$content .= '<img class="img-broadcast" src="'.get_the_post_thumbnail_url($post->ID, 'full').'" />';
$content .= '<h4 class="broadcast-title">'.$post->post_title.'</h4>';
$content .= '</a>';
//$content .= '<p>'.$post['the_permalink'].'</p>';
$content .= "</div>\n";
}
$content .= "</div>\n";
echo $content;
$content = '<hr style="background-color:Gold;border-color:Gold"><hr style="background-color:Gold;border-color:Gold"> <br \> <a style="color:Gold" name="concluse"><h4 style="color:Gold">[[[ CONCLUSE ]]] </h4>';
$content .= "<div class='broadcast-list'>\n";
foreach ($concluse as $post) {
$content .= '<div class="single-broadcast">';
//$content .= '" style="background:url(\''.$post['thumb_url'].'\') no-repeat center center;background-size:cover;">';
//$content .= '<p class="img-url">'.$post['thumb_url'].'</p>';
$content .= '<a href="'.get_permalink($post->ID).'" title="'.$post->post_title.'">';
$content .= '<img class="img-broadcast" src="'.get_the_post_thumbnail_url($post->ID, 'full').'" />';
$content .= '<h4 class="broadcast-title">'.$post->post_title.'</h4>';
$content .= '</a>';
//$content .= '<p>'.$post['the_permalink'].'</p>';
$content .= "</div>\n";
}
$content .= "</div>\n";
echo $content;
//wp_enqueue_style('palinsesto_style', plugin_dir_url(__FILE__).'css/palinsesto.css', array(), '1.0', 'screen');
wp_enqueue_style('trasmissioni_style', plugin_dir_url(__FILE__).'css/trasmissioni.css', array(), '1.0', 'screen');
}
add_shortcode('broadcast_list', 'rwt_broadcast_list');