public function get_shows($hide_empty = true)
 {
     $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => $hide_empty, 'cache_domain' => 'core');
     $podcast_show_slug = dipo_get_podcast_show_slug();
     $podcast_show = get_terms($podcast_show_slug, $args);
     return isset($podcast_show) ? $podcast_show : null;
 }
Exemple #2
0
 /**
  * This method returns all posts in a series. A specific series can be
  * named by passing the series ID. To get that ID use `dipo_get_series()`.
  * If no specific series is named the first series is set as default.
  * @param  integer $series_id ID of series
  * @return array              returns all posts in this series as array
  */
 function dipo_get_episodes($series_id = 0, $show_id = 0, $speaker_id = 0)
 {
     $post_type = Dipo_Podcast_Post_Type::POST_TYPE;
     $series_slug = dipo_get_series_slug();
     $args = array('post_type' => $post_type, 'order' => 'ASC', 'oderby' => 'date', 'tax_query' => array('relation' => 'AND'));
     if (0 === $series_id) {
         $series = dipo_get_series();
         if (is_wp_error($series) and isset($series[0])) {
             return false;
         }
         $series_id = $series[0]->term_id;
     }
     if (is_array($series_id)) {
         foreach ($series_id as $series => $id) {
             $taxonomy = array('taxonomy' => $series_slug, 'field' => 'term_id', 'terms' => (int) $id);
             array_push($args['tax_query'], $taxonomy);
         }
     } else {
         $taxonomy = array('taxonomy' => $series_slug, 'field' => 'term_id', 'terms' => (int) $series_id);
         array_push($args['tax_query'], $taxonomy);
     }
     if (0 !== $speaker_id) {
         $speaker_slug = dipo_get_speaker_slug();
         if (is_array($speaker_id)) {
             foreach ($speaker_id as $speaker => $id) {
                 $taxonomy = array('taxonomy' => $speaker_slug, 'field' => 'term_id', 'terms' => (int) $id);
                 array_push($args['tax_query'], $taxonomy);
             }
         } else {
             $taxonomy = array('taxonomy' => $speaker_slug, 'field' => 'term_id', 'terms' => (int) $speaker_id);
             array_push($args['tax_query'], $taxonomy);
         }
     }
     if (0 !== $show_id) {
         $show_slug = dipo_get_podcast_show_slug();
         if (is_array($show_id)) {
             foreach ($show_id as $show => $id) {
                 $taxonomy = array('taxonomy' => $show_slug, 'field' => 'term_id', 'terms' => (int) $id);
                 array_push($args['tax_query'], $taxonomy);
             }
         } else {
             $taxonomy = array('taxonomy' => $show_slug, 'field' => 'term_id', 'terms' => (int) $show_id);
             array_push($args['tax_query'], $taxonomy);
         }
     }
     $series_posts = new WP_Query($args);
     return $series_posts->posts;
 }
 public function render_dashboard_page()
 {
     if (!current_user_can('edit_posts')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $show_feeds = array();
     $show_terms = get_terms(dipo_get_podcast_show_slug());
     foreach ($show_terms as $show_index => $show) {
         $show_feed = trailingslashit(get_home_url()) . '?post_type=' . \Dicentis\Podcast_Post_Type\Dipo_Podcast_Post_Type::POST_TYPE . '&podcast_show=' . $show->slug . '&feed=pod';
         $show_pretty_feed = trailingslashit(get_home_url()) . 'podcast/show/' . $show->slug . '/feed/pod';
         $show_array = array('name' => $show->name, 'slug' => $show->slug, 'feed' => $show_feed, 'pretty_feed' => $show_pretty_feed);
         array_push($show_feeds, $show_array);
     }
     // Render the dashboard template
     include $this->properties->get('dipo_templates') . '/dashboard-template.php';
 }