Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display schedule for a specific show #5

Open
bryanharley opened this issue Feb 3, 2017 · 1 comment
Open

Display schedule for a specific show #5

bryanharley opened this issue Feb 3, 2017 · 1 comment

Comments

@bryanharley
Copy link
Contributor

bryanharley commented Feb 3, 2017

How can I display when and on what channels a specific show is scheduled? I looked at cablecast_get_schedules, but I don't think I can do it with that function.

@bryanharley
Copy link
Contributor Author

bryanharley commented Mar 10, 2019

Think I figured this out by creating a new function that searches the schedule by show_id

Put this in theme_functions.php or functions.php

function cablecast_get_show_schedule($show_id) {
global $wpdb;
$table = $wpdb->prefix . 'cablecast_schedule_items';
return $wpdb->get_results($wpdb->prepare("SELECT * FROM $table WHERE show_id=%d AND run_date_time >= CURDATE()",
$show_id
));
}

Put this in your own theme file or modify display.php

$get_show_id = get_post_meta($post->ID, 'cablecast_show_id', true);

$schedule_items = cablecast_get_show_schedule($get_show_id);

if(!isset($schedule_items) || $schedule_items == NULL) {
$schedule = array();
} else {
$schedule = is_array($schedule_items) ? $schedule_items : array($scheduleitems);
}
if (count($schedule) == 0) {
echo "\n";
}
else {
echo "Airing";
foreach($schedule as $item) {
$DateTime = date('l, F j - g:ia', strtotime($item->run_date_time));
echo $DateTime;
echo " on ".$item->channel_id."
";
}
}

@bryanharley bryanharley changed the title Show schedule for a show Display schedule for a specific show Mar 18, 2019
@bryanharley bryanharley reopened this Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant