G
G
Gennady Dorokhin2016-04-06 11:23:25
CMS
Gennady Dorokhin, 2016-04-06 11:23:25

Which WP plugin is used to schedule radio broadcasts?

Which WP plugin is used to schedule radio broadcasts?
The schedule should be set from the admin panel for 7 days, what is being broadcast at the moment should be highlighted on the front.
https://yadi.sk/i/Iwrkwymtqmr3m

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2016-04-06
@rpsv

I think it makes no sense to look for plugins, you can quickly throw in a shortcode (well, or a widget) with pens.
Procedure:
Something like an example shortcode:

$nowDay = date("N");
$nowTime = date("G") * 60 + date("i"); // переводим в цифры, с ними удобнее

// выбираем расписание

$posts = new WP_Query([
  "post_type" => "тип поста",
  "meta_query" => [
    [
      "key" => "день недели",
      "value" => $nowDay
    ]
  ]
]);
$posts = $posts->get_posts();

// проходим 

for ($i=0; $i < count($posts); $i++) {
  $cur = $posts[$i];
  $curTime = (int) get_post_meta($cur, "время в цифрах", true);
  $curName = $post->post_title;
  //
  $next = $posts[$i+1];
  $isNowPlay = false;
  if ($next) {
    $nextTime = (int) get_post_meta($next, "время в цифрах", true);
    $isNowPlay = $nowTime >= $curTime && $nowTime < $nextTime;
  }
  //
  $m = $nextTime % 60;
  $h = intval(($nextTime - $m) / 60);
  echo ($isNowPlay) ? "Воспроизводиться сейчас" : $h.":".$m;
  echo $curName;
}

Post title and meta actually substitute your own

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question